コード例 #1
0
        public Opcion Actualizar(Opcion ent)
        {
            var entidad = galaxyContext.Opciones.Find(ent.IdOpcion);

            entidad.NombreOpcion = ent.NombreOpcion;
            entidad.UrlOpcion    = ent.UrlOpcion;
            entidad.NombreIcono  = ent.NombreIcono;

            galaxyContext.SaveChanges();

            return(ent);
        }
コード例 #2
0
        // GET: Tasks/MarkAsDone
        public ActionResult MarkAsDone(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var task = db.Tasks.Find(id);

            task.IsDone          = true;
            db.Entry(task).State = EntityState.Modified;
            db.SaveChanges();

            Employee employee = db.Employees.Find(task.EmployeeId);

            Productivity.CalculateProductivity(employee);
            Productivity.TeamProductivity(employee.Team);
            db.Entry(employee).State = EntityState.Modified;
            db.SaveChanges();

            return(RedirectToAction("Index"));
        }
コード例 #3
0
        public ActionResult Create([Bind(Include = "Id,Name,Lastname,Productivity,TeamId")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                employee.Id = Guid.NewGuid();
                db.Employees.Add(employee);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.TeamId = new SelectList(db.Teams, "Id", "Description", employee.TeamId);
            return(View(employee));
        }