public ActionResult CreateCreativeExp(CreativeExpDTO creativeExpDTO) { if (!ModelState.IsValid) { return(Json(new ReturnFormat(400, "failed", null), JsonRequestBehavior.AllowGet)); } var school = (T_DM_Truong)Session[Constant.SCHOOL_SESSION]; if (school == null) { return(Json(new ReturnFormat(403, "access denied", null), JsonRequestBehavior.AllowGet)); } RegistrationCreativeExp registrationCreativeExp = new RegistrationCreativeExp(); Mapper.Map(creativeExpDTO, registrationCreativeExp); registrationCreativeExp.CreatedAt = DateTime.Now; registrationCreativeExp.SchoolId = school.SchoolID; registrationCreativeExp.SchoolName = school.TenTruong; using (var creative = new RegistrationReativeExpService()) { RegistrationCreativeExp registrationCreativeExpInserted = creative.SaveRegistrationCreativeExp(registrationCreativeExp); //SendMailService sendMailService = new SendMailService(); //sendMailService.SendMailToTeacherAsyncRegistrationCreative(registrationCreativeExpDetail); } return(Json(new ReturnFormat(200, "success", null), JsonRequestBehavior.AllowGet)); }
public RegistrationCreativeExp SaveRegistrationCreativeExp(RegistrationCreativeExp registrationCreativeExp) { using (var _db = new HoatDongTraiNghiemDB()) { _db.RegistrationCreativeExps.Add(registrationCreativeExp); _db.SaveChanges(); return(registrationCreativeExp); } }