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