// public ActionResult PunchIn([Bind(Include = "userId,projectId,orgId")] PunchInVM punchInVM) public ActionResult PunchIn(PunchInVM punchInVM) { try { if (ModelState.IsValid) { if (punchInVM.orgId < 1) { punchInVM.orgId = 1; // force the -1 to be org #1, relies on orgId 1 == "Individual" } TimeSheet sheet = new TimeSheet(); sheet.user_Id = punchInVM.userId; sheet.project_Id = punchInVM.projectId; sheet.clockInTime = DateTime.Now; sheet.clockOutTime = DateTime.Today.AddDays(1); sheet.org_Id = punchInVM.orgId; //TODO: check error code? ReturnStatus st = Repository.PunchIn(sheet); if (st.errorCode != ReturnStatus.ALL_CLEAR) { return(RedirectToAction("HandleErrors", "User", new { excMsg = "punchin action" })); } // return RedirectToAction("VolunteerPortal", "User"); } return(RedirectToAction("VolunteerPortal", "User", new { justPunched = 1 })); } catch { return(View("Error")); } }
public ActionResult _PunchIn(int id) { try { ReturnStatus rs = Repository.GetPunchInVM(id); if (rs.errorCode != 0) { ViewBag.status = "Sorry, system is temporarily down."; return(PartialView("_ErrorPunchIn")); } PunchInVM punchInVM = (PunchInVM)rs.data; return(PartialView("_PunchIn", punchInVM)); } catch { return(View("_Error")); } }