public Response <string> UpdateCustomerOrdersField(int Id, [FromBody] JsonPatch.Model.PatchOperation fieldvalue) { var existingcustomer = CustomerMockData.CustomerList.Where(x => x.Id == Id).FirstOrDefault(); var op = new JsonPatch.JsonPatchDocument <CustomerDetails>(); op.Add(fieldvalue.path, fieldvalue.value); op.ApplyUpdatesTo(existingcustomer); return(new Response <string>() { Body = "Updated successfully.", Code = Status.Success }); }
public Response <string> UpdateAllCustomerField([FromBody] JsonPatch.Model.PatchOperation fieldvalue) { var existingcustomer = CustomerMockData.CustomerList; var op = new JsonPatch.JsonPatchDocument <CustomerDetails>(); foreach (CustomerDetails c in existingcustomer) { op.Add(fieldvalue.path, fieldvalue.value); op.ApplyUpdatesTo(c); } return(new Response <string>() { Body = "Updated successfully.", Code = Status.Success }); }
public Response <string> UpdateCustomerOrders(int Id, [FromBody] JsonPatch.Model.PatchOperation fieldvalue) { var CustDetails = OrderMockData.CustomerOrders.Where(x => x.CustomerId == Id).FirstOrDefault(); var CustOrders = CustDetails.OrderList; var op = new JsonPatch.JsonPatchDocument <Order>(); foreach (var order in CustOrders) { op.Add(fieldvalue.path, fieldvalue.value); op.ApplyUpdatesTo(order); } return(new Response <string>() { Body = "Updated.", Code = Status.Success }); }