public HttpResponseMessage Delete(int id) { response = null; try { Companylist updatejobRelease = db.Companylists.First(x => (x.Id == id)); updatejobRelease.status = "Deactive"; db.SaveChanges(); } catch (Exception ex) { } return(response); }
public HttpResponseMessage Create(CompanyMasterEntities obj) { response = null; var objcon = Regex.Replace(obj.objheader.name, @"\s+", ""); try { var Message = ""; var CompanyTable = new Companylist(); if (obj != null) { var Dupcity = db.Companylists.FirstOrDefault(x => x.name.Replace(" ", "") == objcon); if (Dupcity == null) { CompanyTable.cid = obj.objheader.cid; CompanyTable.code = obj.objheader.code; CompanyTable.name = obj.objheader.name; CompanyTable.status = obj.objheader.status; CompanyTable.createdon = DateTime.Now.ToString(); CompanyMasterRepository.InsertCompanyMaster(CompanyTable); CompanyMasterRepository.SaveCompanyMasterMaster(); Message = "1"; response = Request.CreateResponse <string>(HttpStatusCode.OK, Message); } else { Message = "2"; response = Request.CreateResponse <string>(HttpStatusCode.OK, Message); } } } catch (Exception ex) { //_objErrorHelper.APIMethodName = "Create"; //_objErrorHelper.APIControllerName = "CityAPIController"; //ErrorLogger.LogError(ex, _objErrorHelper); response = Request.CreateResponse <string>(HttpStatusCode.NotFound, "Failed"); } return(response); }