Exemplo n.º 1
0
 public ActionResult Create(TimeLog model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             //model.CreatedUser = CurrentUser.UserName;
             if (model.TimeLogId != 0)
             {
                 //get default value
                 //	TimeLog b = TimeLogManager.GetById(model.TimeLogId);
                 TimeLogManager.Update(model);
             }
             else
             {
                 // TODO: Add insert logic here
                 // model.CreatedDate = SystemConfig.CurrentDate;
                 TimeLogManager.Add(model);
             }
             return(View(ViewFolder + "list.cshtml", TimeLogManager.GetAll()));
         }
     }
     catch
     {
         return(View(model));
     }
     return(View(model));
 }
Exemplo n.º 2
0
        public ContentResult SaveExcel(string item)
        {
            //string b = Request["item"];
            IEnumerable <TimeLog> objItemList = JsonConvert.DeserializeObject <IEnumerable <TimeLog> >(item);

            JsonObject obj = new JsonObject();

            obj.StatusCode = 200;
            obj.Message    = "The process is sucessed";
            foreach (TimeLog objitem in objItemList)
            {
                //default value
                //objitem.CreatedUser = CurrentUser.UserName;
                //    objitem.CreatedDate = SystemConfig.CurrentDate;

                TimeLogManager.Add(objitem);
            }

            return(Content(JsonConvert.SerializeObject(obj), "application/json"));
        }