public PartyResult CreateNewParty(party newParty) { try { if (newParty == null) return new PartyResult(PartyStatus.NoPartyPresent); party party = new party { id = Guid.NewGuid().ToString(), firstName = newParty.firstName, lastName = newParty.lastName, name = newParty.name, pantryId = Guid.NewGuid().ToString() }; _db.party.Add(party); _db.SaveChanges(); return new PartyResult(party); } catch (Exception ex) { return new PartyResult(PartyStatus.Error); } }
public HttpResponseMessage Put(party newParty) { PartySvc svc = new PartySvc(); var result = svc.CreateNewParty(newParty); return Request.CreateResponse(HttpStatusCode.OK, result); }
public PartyResult(party party) { Party = party; Status = PartyStatus.Ok; StatusMessage = Status.ToString(); }