public IHttpActionResult PostBuyerTransportDetail(BuyerTransportDetails buyerTransportDetails) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { if (buyerTransportDetails.BuyerTransportId != 0) { buyerTransportDetails.ModifiedBy = "superadmin"; buyerTransportDetails.ModifiedDate = DateTime.Now; db.BuyerTransport.Attach(buyerTransportDetails); db.Entry(buyerTransportDetails).State = EntityState.Modified; } else { db.BuyerTransport.Add(buyerTransportDetails); } db.SaveChanges(); return(Ok()); } catch (Exception e) { return(InternalServerError(e)); } }
public IHttpActionResult GetBuyerTransportDetail(Guid id) { BuyerTransportDetails buyerTransportDetail = db.BuyerTransport.FirstOrDefault(x => x.BuyerId == id); if (buyerTransportDetail == null) { return(NotFound()); } return(Ok(buyerTransportDetail)); }