public ReturnObject Create([FromBody] Blog entity) { ReturnObject obj = new ReturnObject(); var userName = getClaimsByToken(); DaoBlog daoBlog = new DaoBlog(bookingServicesContext); try { entity.UpdatedBy = userName; entity.CreatedBy = userName; var data = daoBlog.Create(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(); DaoBlog daoBlog = new DaoBlog(bookingServicesContext); try { var response = daoBlog.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 GetAllBlogPage([FromBody] Query query) { ReturnObject obj = new ReturnObject(); DaoBlog daoBlog = new DaoBlog(bookingServicesContext); try { var data = daoBlog.GetAllBlogPage(query.PageSize); 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(); DaoBlog daoBlog = new DaoBlog(bookingServicesContext); try { var data = daoBlog.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); }