コード例 #1
0
        public async Task <ActionResult> ModifyTimeLog(int id)
        {
            ViewBag.SyncType = "Asynchronous";
            int     hours   = Int32.Parse(Request["Time.Hour"]) * 3600;
            int     minutes = Int32.Parse(Request["Time.Minute"]) * 60;
            int     seconds = Int32.Parse(Request["Time.Second"]);
            TimeLog timeLog = new TimeLog();

            timeLog.Time     = DateTime.MinValue + TimeSpan.FromSeconds(hours + minutes + seconds);
            timeLog.Username = GetUsername();
            if (await TimeLogService.SetTimeLog(GetUsername(), timeLog, id))
            {
                return(Redirect(Request.UrlReferrer.ToString()));
            }
            else
            {
                return(View("Error", new ErrorMessageModel()
                {
                    Message = "Time was not modified!"
                }));
            }
        }