public IHttpActionResult Getslot_details(int id) { slot_details slot_details = _slotDetailControllerManager.GetSlotDetail(id); if (slot_details == null) { return(NotFound()); } return(Ok(slot_details)); }
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)); }