Beispiel #1
0
        // GET: Sucursal
        public ActionResult Index()
        {
            var entities = BCSucursal.ListAll();
            var model    = Mapper.Map <List <Sucursal> >(entities);

            return(View(model));
        }
Beispiel #2
0
 public ActionResult DeletePost(int id)
 {
     try
     {
         BCSucursal.Delete(id);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View(id));
     }
 }
Beispiel #3
0
 public ActionResult SearchAllSucursalByBanco(int idBanco)
 {
     try
     {
         IBCSucursal ServiceProvider = new BCSucursal();
         var         searchResult    = ServiceProvider.FindAllSucursalByIdBanco(idBanco);
         return(Json(new { Success = true, Sucursales = searchResult.Sucursales, Total = searchResult.Sucursales.Count }));
     }
     catch (Exception ex)
     {
         return(Json(new { Success = false, Exception = true, Message = ex.Message }));
     }
 }
Beispiel #4
0
 public ActionResult Edit(Sucursal model)
 {
     try
     {
         var entity = Mapper.Map <Business.Entities.Sucursal>(model);
         BCSucursal.Update(entity);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View(model.Id));
     }
 }
Beispiel #5
0
 public ActionResult Create(Sucursal model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             var entity = Mapper.Map <Business.Entities.Sucursal>(model);
             BCSucursal.Create(entity);
             return(RedirectToAction("Index"));
         }
     }
     catch
     {
         //todo:
     }
     return(View(model));
 }
Beispiel #6
0
 // GET: Sucursal/Delete/5
 public ActionResult Delete(int id)
 {
     try
     {
         var entity = BCSucursal.Get(id);
         if (entity == null)
         {
             return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
         }
         var model = Mapper.Map <Sucursal>(entity);
         return(View(model));
     }
     catch
     {
         return(RedirectToAction("Index"));
     }
 }
Beispiel #7
0
        // GET: Sucursal/Edit/5
        public ActionResult Edit(int id)
        {
            try
            {
                var entity = BCSucursal.Get(id);
                if (entity == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }

                var model = Mapper.Map <Sucursal>(entity);
                PopulateBancosDropDownList(model.BancoId);
                return(View(model));
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }