public ReturnObject Update([FromBody] Event entity) { ReturnObject obj = new ReturnObject(); var userName = getClaimsByToken(); DaoEvent daoEvent = new DaoEvent(bookingServicesContext); try { entity.UpdatedBy = userName; var data = daoEvent.Update(entity); if (data != null) { obj.status = 200; obj.data = data; } else { obj.status = 404; } } catch (Exception ex) { obj.status = 404; obj.message = ex.StackTrace; } return(obj); }
public ReturnObject delete([FromBody] Delete data) { ReturnObject obj = new ReturnObject(); DaoEvent daoEvent = new DaoEvent(bookingServicesContext); try { var response = daoEvent.Delete(data.Ids); if (response != null) { obj.status = 200; obj.data = response; } else { obj.status = 404; } } catch (Exception ex) { obj.status = 404; obj.message = ex.StackTrace; } return(obj); }
public ReturnObject GetAll([FromBody] Query query) { ReturnObject obj = new ReturnObject(); DaoEvent daoEvent = new DaoEvent(bookingServicesContext); try { var data = daoEvent.GetAll(query.PageIndex, query.PageSize, query.Title, query.IsPublish); if (data != null) { obj.status = 200; obj.data = data; } else { obj.status = 404; } } catch (Exception ex) { obj.status = 404; obj.message = ex.StackTrace; } return(obj); }
public ReturnObject Get(string id) { ReturnObject obj = new ReturnObject(); DaoEvent daoEvent = new DaoEvent(bookingServicesContext); try { var data = daoEvent.getById(id); if (data != null) { obj.status = 200; obj.data = data; } else { obj.status = 404; } } catch (Exception ex) { obj.status = 404; obj.message = ex.StackTrace; } return(obj); }