-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from ethankershaw/ethankershaw/fix-11
Bump to latest Carter and resolve implementation differences
- Loading branch information
Showing
14 changed files
with
284 additions
and
254 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
namespace CarterSample.Features.Actors | ||
namespace Carter.SirenNegotiator.Sample.Features.Actors; | ||
|
||
public class Actor | ||
{ | ||
public class Actor | ||
{ | ||
public string Name { get; set; } | ||
public int Id { get; set; } | ||
public int Age { get; set; } | ||
} | ||
public string Name { get; set; } | ||
public int Id { get; set; } | ||
public int Age { get; set; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,37 @@ | ||
namespace CarterSample.Features.Actors | ||
namespace Carter.SirenNegotiator.Sample.Features.Actors; | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
public class ActorProvider : IActorProvider | ||
{ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
private static IList<Actor> database = new[] { new Actor { Name = "Brad Pitt", Id = 1, Age = 51 }, new Actor { Name = "Jason Statham", Id = 2, Age = 43 } }; | ||
|
||
public class ActorProvider : IActorProvider | ||
public IEnumerable<Actor> Get() | ||
{ | ||
private static IList<Actor> database = new[] { new Actor { Name = "Brad Pitt", Id = 1, Age = 51 }, new Actor { Name = "Jason Statham", Id = 2, Age = 43 } }; | ||
|
||
public IEnumerable<Actor> Get() | ||
{ | ||
return database; | ||
} | ||
return database; | ||
} | ||
|
||
public Actor Get(int id) | ||
{ | ||
return database.First(x => x.Id == id); | ||
} | ||
public Actor Get(int id) | ||
{ | ||
return database.First(x => x.Id == id); | ||
} | ||
|
||
public void Add(Actor actor) | ||
{ | ||
actor.Id = database.Max(x => x.Id) + 1; | ||
database.Add(actor); | ||
} | ||
public void Add(Actor actor) | ||
{ | ||
actor.Id = database.Max(x => x.Id) + 1; | ||
database.Add(actor); | ||
} | ||
|
||
public void Update(Actor actor) | ||
{ | ||
var actorRef = database.First(x => x.Id == actor.Id); | ||
actorRef.Age = actor.Age; | ||
actorRef.Name = actor.Name; | ||
} | ||
public void Update(Actor actor) | ||
{ | ||
var actorRef = database.First(x => x.Id == actor.Id); | ||
actorRef.Age = actor.Age; | ||
actorRef.Name = actor.Name; | ||
} | ||
|
||
public void Delete(Actor actor) | ||
{ | ||
database.Remove(actor); | ||
} | ||
public void Delete(Actor actor) | ||
{ | ||
database.Remove(actor); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
namespace CarterSample.Features.Actors | ||
{ | ||
using FluentValidation; | ||
namespace Carter.SirenNegotiator.Sample.Features.Actors; | ||
|
||
using FluentValidation; | ||
|
||
public class ActorValidator : AbstractValidator<Actor> | ||
public class ActorValidator : AbstractValidator<Actor> | ||
{ | ||
public ActorValidator() | ||
{ | ||
public ActorValidator() | ||
{ | ||
this.RuleFor(x => x.Name).NotEmpty(); | ||
this.RuleFor(x => x.Name).NotEmpty(); | ||
|
||
this.RuleFor(x => x.Age).GreaterThan(0); | ||
} | ||
this.RuleFor(x => x.Age).GreaterThan(0); | ||
} | ||
} |
Oops, something went wrong.