public override Task <Empty> UpdatePrisoner(PrisonerMessage request, ServerCallContext context) { Prisoner p = ConversionStuff.MessageToPrisoner(request); if (!ValidationUtility.IsPrisonerValid(p)) { return(Task.FromResult(new Empty())); } unitOfWork.PrisonerRepo.Update(p); unitOfWork.Save(); return(Task.FromResult(new Empty())); }
public static Prisoner MessageToPrisoner(PrisonerMessage pm) { return(new Prisoner { PrisonerID = pm.Id, FName = pm.Fname, LName = pm.Lname, Age = pm.Age, LocationID = pm.LocationId, SentenceDate = new DateTime(pm.SentenceDate), ReleaseDate = new DateTime(pm.ReleaseDate) }); }
public async Task AddPrisoner(PrisonerMessage prisonerMessage) { if (client == null || token == "") { Debug.WriteLine("Null client or token"); return; } try { await client.AddPrisonerAsync(prisonerMessage, headers); } catch (Exception e) { Debug.WriteLine(e.Message); } }