public ActionResult Edit(UpdateTimeSheetModel EditModel) { if (Session["Username"] == null) { return(RedirectToAction("Login", "Login")); } else { // int EditId = Convert.ToInt32( TempData["EditID"].ToString()); if (EditModel == null) { Session["ErrorMessage"] = "Please Update With Valid Details!"; } if (EditModel.Day != null && EditModel.StartTime != null && EditModel.EndTime != null) { string dateString = String.Format("{0:dd/MM/yyyy}", EditModel.Day.Value.Date); string StartTimeString = String.Format("{0:HH:mm}", EditModel.StartTime.Value); string EndTimeString = String.Format("{0:HH:mm}", EditModel.EndTime.Value); string dtSt = dateString + " " + StartTimeString; string dtEn = dateString + " " + EndTimeString; var StartdateTime = Convert.ToDateTime(dtSt); var EnddateTime = Convert.ToDateTime(dtEn); EditModel.StartTime = StartdateTime; EditModel.EndTime = EnddateTime; } var ReturnValue = RegisterTimesheetService.EditTimesheetModel(EditModel); } return(RedirectToAction("Index", "Home")); }
public ActionResult UpdateCandidate(UpdateTimeSheetModel CandidateEdit) { if (Session["Username"] == null) { return(RedirectToAction("Login", "Login")); } else { // int EditId = Convert.ToInt32( TempData["EditID"].ToString()); if (CandidateEdit == null) { Session["ErrorMessage"] = "Please Update With Valid Details!"; } if (CandidateEdit != null) { var ReturnValue = RegisterTimesheetService.EditTimesheetModel(CandidateEdit); } } return(RedirectToAction("Index", "Home")); }
public static async Task <ReturnModel> EditTimesheetModel(UpdateTimeSheetModel UpdateModel) { ReturnModel ReturnResult = new ReturnModel(); using (HttpClient client = new HttpClient()) { client.BaseAddress = new Uri(TimeSheetAPIURl); HttpResponseMessage response = client.PostAsJsonAsync(string.Format("TimeSheet/UpdateTimeSheet"), UpdateModel).Result; if (response.IsSuccessStatusCode) { ReturnResult = await response.Content.ReadAsAsync <ReturnModel>(); HttpContext.Current.Session["ResultMessage"] = ReturnResult.Message; } else { HttpContext.Current.Session["ErrorMessage"] = ReturnResult.Message; } } return(ReturnResult); }