public ActionResult ConstructionMeetingEdit(ConstructionMeetingEditModel model) { if (model.FileDinhKemPostFileBase != null && model.FileDinhKemPostFileBase.FileName != "") { var ext = Path.GetExtension(model.FileDinhKemPostFileBase.FileName); var path = DateFolder("/assets/files/", null) + "/" + Guid.NewGuid() + ext; var fp = Server.MapPath(path); model.FileDinhKemPostFileBase.SaveAs(fp); model.FileDinhKem = path; } model.Date = DateTime.ParseExact(model.DateStr, "MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture); var result = _dataService.ConstructionMeetingCommand(model); return(Json(result, JsonRequestBehavior.AllowGet)); }
public ConstructionMeeting ConstructionMeetingCommand(ConstructionMeetingEditModel model) { CheckDbConnect(); var d = Context.ConstructionMeetings.FirstOrDefault(x => x.Id == model.Id) ?? new ConstructionMeeting() { Id = 0, CreatedDate = DateTime.Now }; d.Date = model.Date; d.GioHop = model.GioHop; d.LoaiCuocHop = model.LoaiCuocHop; d.ThanhPhanThamDu = model.ThanhPhanThamDu; d.FileDinhKem = model.FileDinhKem; d.GiamDoc = model.GiamDoc; d.CongTruong = model.CongTruong; if (d.Id == 0) { Context.ConstructionMeetings.Add(d); } Context.SaveChanges(); return(d); }