Ejemplo n.º 1
0
        public async Task <IActionResult> Add(ProjectInputmodel input)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.View(input));
            }

            var userId = this.userManager.GetUserId(this.User);

            await this.projectServices.CreateAsync <ProjectInputmodel>(input, userId);

            return(this.RedirectToAction(nameof(ProfilesController.Profile), "Profiles"));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, ProjectInputmodel input)
        {
            if (!this.HasPermission(id))
            {
                return(this.Unauthorized());
            }

            if (!this.ModelState.IsValid)
            {
                var project = this.projectServices.GetById <EditProjectInputModul>(id);

                return(this.View(project));
            }

            await this.projectServices.UpdateAsync <ProjectInputmodel>(input, id);

            return(this.RedirectToAction(nameof(ProfilesController.Profile), "Profiles"));
        }