public HttpResponseMessage UpdateQuotation(Entities.TrnQuotation objQuotation, String id) { try { var quotaion = from d in db.IS_TrnQuotations where d.Id == Convert.ToInt32(id) select d; if (quotaion.Any()) { var updateQuotaion = quotaion.FirstOrDefault(); updateQuotaion.QuotationNumber = objQuotation.QuotationNumber; updateQuotaion.QuotationDate = Convert.ToDateTime(objQuotation.QuotationDate); updateQuotaion.LeadId = objQuotation.LeadId; updateQuotaion.CustomerId = objQuotation.CustomerId; updateQuotaion.ProductId = objQuotation.ProductId; updateQuotaion.Remarks = objQuotation.Remarks; updateQuotaion.QuotationStatus = objQuotation.QuotationStatus; db.SubmitChanges(); return(Request.CreateResponse(HttpStatusCode.OK, "Successfully Updated!")); } else { return(Request.CreateResponse(HttpStatusCode.OK, "Data Not Exist!")); }; } catch (Exception e) { Debug.WriteLine(e); return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Something's went wrong!")); } }
public HttpResponseMessage AddQuotation(Entities.TrnQuotation objQuotation) { try { Data.IS_TrnQuotation newQuotation = new Data.IS_TrnQuotation { Id = objQuotation.Id, QuotationNumber = objQuotation.QuotationNumber, QuotationDate = Convert.ToDateTime(objQuotation.QuotationDate), LeadId = objQuotation.LeadId, CustomerId = objQuotation.CustomerId, ProductId = objQuotation.ProductId, Remarks = objQuotation.Remarks, EncodedByUserId = objQuotation.EncodedByUserId, QuotationStatus = objQuotation.QuotationStatus }; db.IS_TrnQuotations.InsertOnSubmit(newQuotation); db.SubmitChanges(); return(Request.CreateResponse(HttpStatusCode.OK, "Successfully Added!")); } catch (Exception e) { Debug.WriteLine(e); return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Something's went wrong!")); } }