// GET: Models/Edit/5 public ActionResult Edit(int id) { Model model = Repositry.Get(id); ViewBag.CategoryId = new SelectList(CategoryRepo.GetAll(), "Id", "Name"); return(PartialView("Edit", model)); }
public SaleOrderBiz(Repositry <BuySellDoc> entityDal, BizParameters bizParameters, OwnerBiz ownerBiz, CustomerBiz customerBiz, ProductBiz productBiz, BuySellDocBiz buySellDocBiz) : base(entityDal, bizParameters, ownerBiz, customerBiz, productBiz) { _ownerBiz = ownerBiz; _customerBiz = customerBiz; _productBiz = productBiz; buySellDocBiz = _buySellDocBiz; }
public ActionResult Create(Model collection) { try { if (ModelState.IsValid) { Repositry.Add(collection); Repositry.SaveAll(); return(Ok("The Model has been Created")); } return(BadRequest("The Model is Not Valid")); } catch { return(BadRequest("An Error Has Occurred.")); } }
public ActionResult Delete(int id) { try { Model model = Repositry.Get(id); if (model == null) { return(NotFound("The Model is not found")); } this.Repositry.Delete(model); this.Repositry.SaveAll(); return(Ok("The Model has been deleted")); } catch { return(BadRequest("An Error Has Occurred.")); } }
//get all requests for user in condition role group public async Task <IHttpActionResult> Get(int userid) { // all this code because generic repositry it is anti pattern and because using async task Repositry <usersrole> userRoleRepositry = UOW.GetReposityInstance <usersrole>(); //repositry for table user role IEnumerable <usersrole> usesrRolesAll = await userRoleRepositry.GetAll(); //get all data IEnumerable <usersrole> RolesOfuser = usesrRolesAll.Where(ur => ur.UserId == userid); //filter for just user IEnumerable <request> AllRequests = await Repo.GetAll(); //get all requests List <request> requests = new List <request>(); foreach (usersrole ur in RolesOfuser) { requests.AddRange(AllRequests.Where(AR => AR.role == ur.Roleid)); //get requests with this role } return(Ok(requests)); }
public userController() { Repo = UOW.GetReposityInstance <user>(); }
public roleuserController() { Repo = UOW.GetReposityInstance <usersrole>(); }
public ActionResult GetModals(int start = 0, int length = 10) { string search = HttpContext.Request.Query["search[value]"]; return(Json(Repositry.GetDataTable(start, length, a => a.Name.Contains(search), a => a.Id))); }
public requestController() { Repo = UOW.GetReposityInstance <request>(); }