public ActionResult Create([Bind(Include = "BusinessId,BusinessLocationId,RoleId,StartTime,FinishTime,FinishNextDay")] ShiftBlockDTO shiftblockdto) { if (shiftblockdto.StartTime > shiftblockdto.FinishTime && !shiftblockdto.FinishNextDay) { ModelState.AddModelError(String.Empty, "Start time must be before the finish time or next day finish must be selected"); } if (ModelState.IsValid) { using (HttpClientWrapper httpClient = new HttpClientWrapper(Session)) { var responseMessage = httpClient.PostAsJsonAsync("api/ShiftBlockAPI", shiftblockdto).Result; responseMessage.EnsureSuccessStatusCode(); CacheManager.Instance.Remove(CacheManager.CACHE_KEY_BUSINESS_LOCATION + shiftblockdto.BusinessLocationId.ToString()); //Remove the stale business item from the cache CacheManager.Instance.Remove(CacheManager.CACHE_KEY_BUSINESS + shiftblockdto.BusinessId.ToString()); //Remove the stale business item from the cache return(RedirectToAction("Index", new { businesslocationid = shiftblockdto.BusinessLocationId })); } } //Get roles for business using (BusinessController bc = new BusinessController()) { var busLoc = bc.GetBusinessLocation(shiftblockdto.BusinessLocationId, this.Session); ViewBag.BusinessRoles = bc.GetBusinessRoles(busLoc.BusinessId, this.Session); ViewBag.BusinessId = shiftblockdto.BusinessId; ViewBag.BusinessLocationId = shiftblockdto.BusinessLocationId; } return(PartialView()); }
// // GET: /Employee/ public ActionResult Index(Guid businesslocationid) { BusinessController bc = new BusinessController(); var busLoc = bc.GetBusinessLocation(businesslocationid, this.Session); ViewBag.BusinessLocationId = businesslocationid; ViewBag.BusinessId = busLoc.BusinessId; return(PartialView(GetEmployeesList(businesslocationid))); }
// GET: /ShiftBlock/Create public ActionResult Create(Guid businesslocationid) { //Get roles for business using (BusinessController bc = new BusinessController()) { var busLoc = bc.GetBusinessLocation(businesslocationid, this.Session); ViewBag.BusinessRoles = bc.GetBusinessRoles(busLoc.BusinessId, this.Session); ViewBag.BusinessLocationId = businesslocationid; } return(PartialView()); }
// GET: /ShiftBlock/ public ActionResult Index(Guid businesslocationid) { ViewBag.BusinessLocationId = businesslocationid; using (var bc = new BusinessController()) { var bus = bc.GetBusinessLocation(businesslocationid, this.Session); ViewBag.BusinessId = bus.BusinessId; } using (HttpClientWrapper httpClient = new HttpClientWrapper(Session)) { Task <String> response = httpClient.GetStringAsync("api/ShiftBlockAPI/businesslocation/" + businesslocationid.ToString() + "/shiftblocks"); var shiftBlocks = (Task.Factory.StartNew(() => JsonConvert.DeserializeObject <IEnumerable <ShiftBlockDTO> >(response.Result)).Result); return(PartialView(shiftBlocks)); } }
public ActionResult DeleteConfirmed(Guid businesslocationId, Guid id) { //Get roles for business BusinessController bc = new BusinessController(); var busLoc = bc.GetBusinessLocation(businesslocationId, this.Session); using (HttpClientWrapper httpClient = new HttpClientWrapper(Session)) { var responseMessage = httpClient.DeleteAsync("api/ShiftBlockAPI/" + id.ToString()).Result; responseMessage.EnsureSuccessStatusCode(); CacheManager.Instance.Remove(CacheManager.CACHE_KEY_BUSINESS_LOCATION + busLoc.Id.ToString()); //Remove the stale business item from the cache CacheManager.Instance.Remove(CacheManager.CACHE_KEY_BUSINESS + busLoc.BusinessId.ToString()); //Remove the stale business item from the cache } return(RedirectToAction("Index", new { businesslocationid = businesslocationId })); }
// // GET: /Business/InternalLocationIndex/5 public ActionResult RecurringShiftIndex(Guid businesslocationid) { using (BusinessController bc = new BusinessController()) { var busLocDTO = bc.GetBusinessLocation(businesslocationid, this.Session); BusinessDTO businessDTO = bc.GetBusiness(busLocDTO.BusinessId, this.Session); ViewBag.HasInternalLocations = businessDTO.HasMultiInternalLocations; ViewBag.BusinessLocationId = businesslocationid; ViewBag.BusinessId = busLocDTO.BusinessId; } using (HttpClientWrapper httpClient = new HttpClientWrapper(Session)) { Task <String> response = httpClient.GetStringAsync("api/ShiftTemplateAPI?businesslocationid=" + businesslocationid.ToString()); var shiftTemplates = Task.Factory.StartNew(() => JsonConvert.DeserializeObject <IEnumerable <ShiftTemplateDTO> >(response.Result)).Result; return(PartialView(shiftTemplates)); } }
// GET: /ShiftBlock/Edit/5 public ActionResult Edit(Guid?id, Guid businesslocationId) { //Get roles for business BusinessController bc = new BusinessController(); var busLoc = bc.GetBusinessLocation(businesslocationId, this.Session); ViewBag.BusinessRoles = bc.GetBusinessRoles(busLoc.BusinessId, this.Session); ViewBag.BusinessId = busLoc.BusinessId; ViewBag.BusinessLocationId = businesslocationId; if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } else { using (HttpClientWrapper httpClient = new HttpClientWrapper(Session)) { Task <String> response = httpClient.GetStringAsync("api/ShiftBlockAPI/" + id.ToString()); var shiftBlockDTO = (Task.Factory.StartNew(() => JsonConvert.DeserializeObject <ShiftBlockDTO>(response.Result)).Result); return(PartialView(shiftBlockDTO)); } } }