Exemple #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));
        }
Exemple #2
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));
        }