public async Task <IActionResult> Edit(int id, [Bind("ExpertiseId,Name")] Expertise expertise)
        {
            if (id != expertise.ExpertiseId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    using var context = new SqlLiteContext();
                    context.Update(expertise);
                    await context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ExpertiseExists(expertise.ExpertiseId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(expertise));
        }
Example #2
0
        public async Task <IActionResult> Edit(int id, [Bind("CompanyId,CompanyName,ProfileCompanyAdress,ProfileCompanyPostalAdress,City")] Company company)
        {
            if (id != company.CompanyId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    using var context = new SqlLiteContext();
                    context.Update(company);
                    await context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CompanyExists(company.CompanyId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(company));
        }
Example #3
0
        public async Task <IActionResult> Edit(int id, [Bind("TrainingId,Name,IsDegree")] Training training)
        {
            if (id != training.TrainingId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    var context = new SqlLiteContext();
                    context.Update(training);
                    await context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TrainingExists(training.TrainingId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(training));
        }
        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());
        }
        public async Task <IActionResult> Edit(EmployeeViewModel model)
        {
            if (ModelState.IsValid)
            {
                Employee employee = EmployeeService.Get(model.EmployeeId);

                if (model.ProfileImage != null)
                {
                    string uniqueFileName = UploadedFile(model);
                    employee.ProfilePicture = uniqueFileName;
                }
                employee.EmployeeId   = model.EmployeeId;
                employee.City         = model.City;
                employee.Tele         = model.Tele;
                employee.Linkedin     = model.Linkedin;
                employee.Mail         = model.Mail;
                employee.EmployeeName = model.EmployeeName;
                employee.EmployeeInfo = model.EmployeeInfo;
                employee.EmployeRole  = model.EmployeRole;
                employee.Interest     = model.Interest;

                try
                {
                    var context = new SqlLiteContext();
                    context.Update(employee);
                    await context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EmployeeExists(employee.EmployeeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View());
        }