public HttpResponseMessage saveProduct(DTOProduct_service request) { using (var db = new KOCSAMADLSEntities()) { var errormessage = new DTOResponseError { errorCode = 1, errorMessage = "İşlem Başarılı" }; var dpro = db.product_service.Where(t => t.productid == request.productid).FirstOrDefault(); dpro.productname = request.productname; dpro.category = request.category; dpro.maxduration = request.maxduration; dpro.automandatorytasks = request.automandatorytasks; dpro.documents = request.documents; dpro.lastupdated = DateTime.Now; dpro.updatedby = KOCAuthorization.KOCAuthorizeAttribute.getCurrentUser().userId; db.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, errormessage, "application/json")); } }
public HttpResponseMessage insertProduct(DTOProduct_service request) { using (var db = new KOCSAMADLSEntities()) { var errormessage = new DTOResponseError { errorCode = 1, errorMessage = "İşlem Başarılı" }; var p = new adsl_product_service { productname = request.productname, category = request.category, automandatorytasks = request.automandatorytasks, maxduration = request.maxduration, documents = request.documents, creationdate = DateTime.Now, lastupdated = DateTime.Now, deleted = false, updatedby = KOCAuthorization.KOCAuthorizeAttribute.getCurrentUser().userId, }; db.product_service.Add(p); db.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, errormessage, "application/json")); } }