示例#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));
 }
示例#2
0
        public ContentResult Save(string objdata, string value)
        {
            JsonObject js = new JsonObject();

            js.StatusCode = 200;
            js.Message    = "Upload Success";
            try
            {
                TimeLog obj = JsonConvert.DeserializeObject <TimeLog>(objdata);
                obj = TimeLogManager.Update(obj);
                if (obj.TimeLogId == 0)
                {
                    js.StatusCode = 400;
                    js.Message    = "Has Errors. Please contact Admin for more information";
                }
                else
                {
                    js.Data = obj;
                }
            }
            catch (Exception objEx)
            {
                js.StatusCode = 400;
                js.Message    = objEx.Message;
            }

            return(Content(JsonConvert.SerializeObject(js), "application/json"));
        }
示例#3
0
 public ActionResult Update(TimeLog model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             // TODO: Add insert logic here
             TimeLogManager.Update(model);
             //return RedirectToAction("Index");
         }
         return(View(model));
     }
     catch
     {
         return(View(model));
     }
 }