Ejemplo n.º 1
0
        public ActionResult Create(SocialWorkCreateVM model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    social_work sw = new social_work()
                    {
                        name           = model.name,
                        description    = model.description,
                        phone          = model.phone,
                        mail           = model.mail,
                        register_date  = DateTime.Now,
                        create_user_id = int.Parse(Session["UserID"].ToString()),
                    };

                    _repo.SocialWorkAdd(sw);

                    //log.Info($"Usuario:{Session["UserID"]} - {User.Identity.Name} carga el archivo {model.file.FileName} - Grupo {model.group_name} con {cant} número de teléfonos.");
                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", "Se produjo un error, en caso de persistir, ponerse en contacto con el Administrador.");
                //log.Error($"Create - {ex.Message}", ex);
            }

            return(View(model));
        }
Ejemplo n.º 2
0
        // GET: Users/Delete/5
        public ActionResult Delete(long id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            social_work sw = _repo.SocialWorkFind(id);

            SocialWorkCreateVM model = new SocialWorkCreateVM()
            {
                id          = sw.id,
                name        = sw.name,
                description = sw.description,
                phone       = sw.phone,
                mail        = sw.mail,
            };

            if (sw == null)
            {
                return(HttpNotFound());
            }

            return(View(model));
        }
Ejemplo n.º 3
0
        public ActionResult DeleteConfirmed(long id)
        {
            social_work sw = _repo.SocialWorkFind(id);

            sw.activo = 0;
            _repo.SocialWorkUpdate(sw);

            return(RedirectToAction("Index"));
        }