public int UpdateJSSETemp(T_JSSE_Main jsse, byte[] image, string imgName) { int result = 0; var context = Global.Context; var jsseModel = context.T_JSSE_Main.Where(js => js.JSSE_ID == jsse.JSSE_ID).FirstOrDefault(); if (jsseModel != null) { jsseModel.Location = jsse.Location; //jsseModel.Region_ID = jsse.Region_ID; jsseModel.CreatedBy = jsse.ModifiedBy; jsseModel.ModifiedBy = jsse.ModifiedBy; jsseModel.JSSEDate = jsse.JSSEDate; jsseModel.Status = jsse.Status; jsseModel.ModifiedDate = DateTime.Now; if (image != null && !string.IsNullOrWhiteSpace(imgName)) { T_JSSE_Attachments attch = new T_JSSE_Attachments(); attch.JSSE_ID = jsse.JSSE_ID; attch.FileName = imgName; attch.Title = imgName; attch.Image = image; attch.Active = true; context.T_JSSE_Attachments.Add(attch); } result = context.SaveChanges(); } return(result); }
public int UpdateJSSETemp(JSSEMain jsse, byte[] image, string imageName) { T_JSSE_Main jsseModel = new T_JSSE_Main(); jsseModel.ModifiedBy = jsse.JSSEEnteredBy.ToLower().IndexOf("coned") >= 0 ? jsse.JSSEEnteredBy : "CONED\\" + jsse.JSSEEnteredBy; jsseModel.Location = jsse.Location; jsseModel.Status = jsse.JSSEStatus; jsseModel.Region_ID = jsse.Region_ID; jsseModel.JSSEDate = jsse.JSSEDate; jsseModel.JSSE_ID = jsse.JSSE_ID; return(jsseRepo.UpdateJSSETemp(jsseModel, image, imageName)); }