Exemplo n.º 1
0
        public IHttpActionResult Putslot_details(int id, slot_details slot_details)
        {
            if (id != slot_details.slot_details_id)
            {
                return(BadRequest());
            }

            try
            {
                _slotDetailControllerManager.UpdateSlotDetail(id, slot_details);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!_slotDetailControllerManager.SlotDetailExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 2
0
 public void RemoveSlotDetail(slot_details entity)   //implementation of RemoveSlotDetail(slot_details entity) in ISlotDetailControllerManager
 {
     try
     {
         _slotDetailService.Remove(entity);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 3
0
 public void UpdateSlotDetail(int id, slot_details entity)   //implementation of UpdateSlotDetail(int id, slot_details entity) in ISlotDetailControllerManager
 {
     try
     {
         _slotDetailService.Update(id, entity);
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemplo n.º 4
0
        public IHttpActionResult Getslot_details(int id)
        {
            slot_details slot_details = _slotDetailControllerManager.GetSlotDetail(id);

            if (slot_details == null)
            {
                return(NotFound());
            }

            return(Ok(slot_details));
        }
Exemplo n.º 5
0
 public ActionResult Edit(int id, slot_details entity)
 {
     try
     {
         HttpResponseMessage response = GlobalVariables.Place4meWebAPIClient.PutAsJsonAsync("SlotDetails/" + id, entity).Result;
         TempData["SuccessMessage"] = "Update Successfully";
         return(RedirectToAction("Index", "Carparks"));
     }
     catch
     {
         return(View());
     }
 }
Exemplo n.º 6
0
 public ActionResult Create(slot_details entity)
 {
     try
     {
         HttpResponseMessage response = GlobalVariables.Place4meWebAPIClient.PostAsJsonAsync("SlotDetails", entity).Result;
         TempData["SuccessMessage"] = "Saved Successfully";
         return(RedirectToAction("Index", "Carparks"));
     }
     catch (Exception)
     {
         return(View());
     }
 }
Exemplo n.º 7
0
        public IHttpActionResult Putslot(int id, slot slot)
        {
            if (id != slot.slot_id)
            {
                return(BadRequest());
            }

            try
            {
                _slotControllerManager.UpdateSlot(id, slot);

                slot_details entity = new slot_details();

                if (slot.slot_isFree == 1)
                {
                    entity.slot_id = id;
                    entity.slot_details_parked_date = DateTime.Now.Date;
                    entity.slot_details_parked_time = DateTime.Now.ToString("HH:mm:ss");
                    _slotDetailsControllerManager.AddSlotDetail(entity);
                }
                else if (slot.slot_isFree == 0)
                {
                    slot_details existingEntity = _slotDetailsControllerManager.GetSlotDetail(id);
                    existingEntity.slot_details_parked_end_time = DateTime.Now.ToString("HH:mm:ss");
                    _slotDetailsControllerManager.UpdateSlotDetail(existingEntity.slot_details_id, existingEntity);
                }
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!_slotControllerManager.SlotExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 8
0
        public IHttpActionResult Postslot_details(slot_details slot_details)
        {
            _slotDetailControllerManager.AddSlotDetail(slot_details);

            return(CreatedAtRoute("DefaultApi", new { id = slot_details.slot_details_id }, slot_details));
        }