public HttpResponseMessage insertStockCard(DTOstockcard request) { var user = KOCAuthorizeAttribute.getCurrentUser(); using (var db = new CRMEntities()) { var errormessage = new DTOResponseError { errorCode = 1, errorMessage = "İşlem Başarılı" }; var s = new stockcard { productname = request.productname, category = request.category, hasserial = request.hasserial, unit = request.unit, description = request.description, creationdate = DateTime.Now, lastupdated = DateTime.Now, deleted = false, updatedby = user.userId }; db.stockcard.Add(s); db.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, errormessage, "application/json")); } }
public HttpResponseMessage saveStockCard(DTOstockcard request) { using (var db = new KOCSAMADLSEntities()) { var errormessage = new DTOResponseError { errorCode = 1, errorMessage = "İşlem Başarılı" }; var ds = db.stockcard.Where(t => t.stockid == request.stockid).FirstOrDefault(); ds.productname = request.productname; ds.category = request.category; ds.hasserial = request.hasserial; ds.unit = request.unit; ds.description = request.description; ds.lastupdated = DateTime.Now; ds.updatedby = KOCAuthorization.KOCAuthorizeAttribute.getCurrentUser().userId; db.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK, errormessage, "application/json")); } }