public static Delivery GetDeliveryDomain(DeliveryManage dm) { return(new Delivery { DeliveryId = dm.DeliveryId, InvoiceId = dm.InvoiceId, ApplicationUserId = dm.AgentId, Title = dm.Title, DeliveryTime = dm.DeliveryTime, CreatedOn = dm.CreatedOn, DeliveryDate = dm.DeliveryDate, Notes = dm.Notes, IsDelivered = dm.IsDelivered }); }
public async Task <IHttpActionResult> PostDelivery(DeliveryManage deliveryManage) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } Delivery delivery = ModelHelper.GetDeliveryDomain(deliveryManage); delivery.CreatedOn = DateTime.Now; db.Deliveries.Add(delivery); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = deliveryManage.DeliveryId }, deliveryManage)); }