public HttpResponseMessage AddSupporty(Entities.TrnSupport objSupport) { try { Data.IS_TrnSupport newSupport = new Data.IS_TrnSupport { Id = objSupport.Id, SupportNumber = objSupport.SupportNumber, SupportDate = Convert.ToDateTime(objSupport.SupportDate), ContinuityId = objSupport.ContinuityId, IssueCategory = objSupport.IssueCategory, Issue = objSupport.Issue, CustomerId = objSupport.CustomerId, ProductId = objSupport.ProductId, Severity = objSupport.Severity, Caller = objSupport.Caller, Remarks = objSupport.Remarks, ScreenShotURL = objSupport.ScreenShotURL, SupportType = objSupport.SupportType, EncodedByUserId = objSupport.EncodedByUserId, AssignedToUserId = objSupport.AssignedToUserId, SupportStatus = objSupport.SupportStatus }; db.IS_TrnSupports.InsertOnSubmit(newSupport); db.SubmitChanges(); return(Request.CreateResponse(HttpStatusCode.OK, "Successfully Added!")); } catch (Exception e) { Debug.WriteLine(e); return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Something's went wrong!")); } }
public HttpResponseMessage UpdateSupport(Entities.TrnSupport objSupport, String id) { try { var support = from d in db.IS_TrnSupports where d.Id == Convert.ToInt32(id) select d; if (support.Any()) { var updatesupport = support.FirstOrDefault(); updatesupport.SupportNumber = objSupport.SupportNumber; updatesupport.SupportDate = Convert.ToDateTime(objSupport.SupportDate); updatesupport.ContinuityId = objSupport.ContinuityId; updatesupport.IssueCategory = objSupport.IssueCategory; updatesupport.Issue = objSupport.Issue; updatesupport.CustomerId = objSupport.CustomerId; updatesupport.ProductId = objSupport.ProductId; updatesupport.Severity = objSupport.Severity; updatesupport.Caller = objSupport.Caller; updatesupport.Remarks = objSupport.Remarks; updatesupport.ScreenShotURL = objSupport.ScreenShotURL; updatesupport.SupportType = objSupport.SupportType; updatesupport.EncodedByUserId = objSupport.EncodedByUserId; updatesupport.AssignedToUserId = objSupport.AssignedToUserId; updatesupport.SupportStatus = objSupport.SupportStatus; 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!")); } }