コード例 #1
0
        // 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));
        }
コード例 #2
0
 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;
 }
コード例 #3
0
 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."));
     }
 }
コード例 #4
0
 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."));
     }
 }
コード例 #5
0
        //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));
        }
コード例 #6
0
 public userController()
 {
     Repo = UOW.GetReposityInstance <user>();
 }
コード例 #7
0
 public roleuserController()
 {
     Repo = UOW.GetReposityInstance <usersrole>();
 }
コード例 #8
0
        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)));
        }
コード例 #9
0
 public requestController()
 {
     Repo = UOW.GetReposityInstance <request>();
 }