Exemplo n.º 1
0
        public ActionResult DeleteByEmployee(int id)
        {
            Assigment assignment = AssignmentService.Get(id);

            AssignmentService.Delete(assignment);

            return(RedirectToAction("Cv", "Home", new { id = assignment.Employeeid }));
        }
Exemplo n.º 2
0
        public ActionResult UpdateByEmployee(int employeeid, int id, string uppdrag, string roll, string tid, string beskrivning, string teknik, string focus)
        {
            Assigment assignment = AssignmentService.Get(id);

            assignment.Roll    = roll;
            assignment.Uppdrag = uppdrag;

            assignment.Tid         = tid;
            assignment.Beskrivning = beskrivning;
            assignment.Teknik      = teknik;
            assignment.Focus       = check(focus);

            AssignmentService.Update(assignment);

            return(RedirectToAction("Cv", "Home", new { id = employeeid }));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Employee,EmployeeId,Uppdrag,Tid,Roll,Beskrivning,Teknik,Focus")] AssignmentViewModel assigmentviewmodel)
        {
            if (id != assigmentviewmodel.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    Assigment assignment = AssignmentService.Get(assigmentviewmodel.Id);

                    assignment.Id          = assigmentviewmodel.Id;
                    assignment.Employeeid  = assigmentviewmodel.Employee.EmployeeId;
                    assignment.Beskrivning = assigmentviewmodel.Beskrivning;
                    assignment.Focus       = assigmentviewmodel.Focus;
                    assignment.Uppdrag     = assigmentviewmodel.Uppdrag;
                    assignment.Roll        = assigmentviewmodel.Roll;
                    assignment.Teknik      = assigmentviewmodel.Teknik;
                    assignment.Tid         = assigmentviewmodel.Tid;

                    var context = new SqlLiteContext();
                    context.Update(assignment);
                    await context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AssigmentExists(assigmentviewmodel.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }

            return(View());
        }