Exemple #1
0
        public CustomerBOResponse Update(CustomerBORequest customerBORequest)
        {
            var customerRequest = _mapper.Map <customer>(customerBORequest);
            var customer        = _customerRepository.Update(customerRequest);

            return(_mapper.Map <CustomerBOResponse>(customer));
        }
Exemple #2
0
        public CustomerBOResponse Add(CustomerBORequest customerBORequest)
        {
            var      customerRequest = _mapper.Map <customer>(customerBORequest);
            customer customer        = _customerRepository.Add(customerRequest);

            return(_mapper.Map <CustomerBOResponse>(customer));
        }
 public ActionResult Edit(CustomerBORequest customerBORequest)
 {
     if (ModelState.IsValid)
     {
         var customer = _customerService.Update(customerBORequest);
         TempData["Message"] = "Updated Successfully.";
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View());
     }
 }
        public ActionResult Add([Bind(Exclude = "customer_id")] CustomerBORequest customerBORequest)
        {
            if (ModelState.IsValid)
            {
                var customer = _customerService.Add(customerBORequest);

                //!Key-Information
                //!Commenting because viewbag is used to transfer data from action methods to view only, it can used to transfer data from one action methods to another.
                //!The scope of ViewBag is permitted to the current request and the value of ViewBag will become null while redirecting.
                //Todo: Need to change to TempData
                //x ViewBag.Message = "Added Successfully.";
                TempData["Message"] = "Added Successfully.";
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View());
            }
        }
 public ActionResult Delete(CustomerBORequest customerBORequest)
 {
     _customerService.Delete(customerBORequest.customer_id);
     TempData["Message"] = "Deleted Successfully.";
     return(RedirectToAction("Index"));
 }