public ContentResult SaveExcel(string item) { //string b = Request["item"]; IEnumerable <ScheduleTask> objItemList = JsonConvert.DeserializeObject <IEnumerable <ScheduleTask> >(item); JsonObject obj = new JsonObject(); obj.StatusCode = 200; obj.Message = "The process is sucessed"; foreach (ScheduleTask objitem in objItemList) { //default value objitem.CreatedUser = CurrentUser.EmployeeCode; objitem.CreatedDate = SystemConfig.CurrentDate; objitem.CompanyID = CurrentUser.CompanyID; ScheduleTaskManager.Add(objitem); } return(Content(JsonConvert.SerializeObject(obj), "application/json")); }
public ActionResult Create(ScheduleTask model) { try { if (ModelState.IsValid) { model.CompanyID = CurrentUser.CompanyID; if (model.Id != 0) { //get default value ScheduleTask objOldScheduleTask = ScheduleTaskManager.GetById(model.Id, CurrentUser.CompanyID); if (objOldScheduleTask != null) { model.CreatedDate = objOldScheduleTask.CreatedDate; model.CreatedUser = objOldScheduleTask.CreatedUser; } ScheduleTaskManager.Update(model); } else { // TODO: Add insert logic here model.CreatedUser = CurrentUser.EmployeeCode; model.CreatedDate = SystemConfig.CurrentDate; ScheduleTaskManager.Add(model); } return(View(ViewFolder + "list.cshtml", ScheduleTaskManager.GetAll(CurrentUser.CompanyID))); } } catch (Exception ObjEx) { //LogHelper.AddLog(new IfindLog() {LinkUrl=Request.Url.AbsoluteUri,Exception= ObjEx.Message,Message = ObjEx.StackTrace}); return(View(model)); } return(View(model)); }