public IEnumerable <Complaints> Get() { using (BODBcontext context = new BODBcontext()) { return(context.Complaints.Where(w => w.Publish == true).OrderByDescending(o => o.CreatedDate).ToList()); } }
public Company Get(int id) { using (BODBcontext context = new BODBcontext()) { return(context.Company.Where(w => w.Id == id).FirstOrDefault()); } }
public Response Post([FromBody] Complaints complaints) { try { using (BODBcontext context = new BODBcontext()) { context.Complaints.Add(complaints); context.SaveChanges(); } response.IsSuccess = true; response.Message = "Kayıt Eklendi"; } catch (Exception ex) { response.IsSuccess = false; response.Message = ex.Message.ToString(); } return(response); }