public IHttpActionResult PutRestucturingHeader(int id, RestucturingHeader restucturingHeader) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != restucturingHeader.Id) { return(BadRequest()); } db.Entry(restucturingHeader).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!RestucturingHeaderExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetRestucturingHeader(string id) { RestucturingHeader restucturingHeader = db.RestucturingHeaders.Where(i => i.Cust_Id == id).FirstOrDefault(); if (restucturingHeader == null) { return(NotFound()); } Customer customer = db.Customers.Find(restucturingHeader.Cust_Id); List <RestucturingDetail> restucturingDetail = db.RestucturingDetails.Where(i => i.Cust_id == restucturingHeader.Cust_Id).ToList(); RestucturingDecorator restucturingDecorator = new RestucturingDecorator(restucturingDetail, customer, restucturingHeader); return(Ok(restucturingDecorator)); }
public RestucturingDecorator(List <RestucturingDetail> _detaildata, Customer _customer, RestucturingHeader _data) { entData = _data; customer = _customer; detailData = _detaildata; }