public async Task <ActionResult> Edit(Project project, HttpPostedFileBase[] files, int[] TechnologyID)
        {
            if (ModelState.IsValid)
            {
                DbAdaptor dbAdaptor = new DbAdaptor();
                Image     img       = null;
                foreach (var file in files)
                {
                    if (file != null)
                    {
                        img = new Image {
                            ImageData = new byte[file.ContentLength], ImageMimeType = file.ContentType,
                        };
                        file.InputStream.Read(img.ImageData, 0, file.ContentLength);
                        img.ProjectID = project.ProjectID;
                        await DbAdaptor.CreateImageAsync(img);
                    }
                }

                if (TechnologyID != null)
                {
                    foreach (var elem in TechnologyID)
                    {
                        await DbAdaptor.CreateProjectTechnologyAsync(new ProjectTechnology
                        {
                            ProjectID    = project.ProjectID,
                            TechnologyID = elem,
                        });
                    }
                }

                await DbAdaptor.EditProjectAsync(project);

                return(RedirectToAction("Index"));
            }

            ViewBag.Lang = new SelectList(new List <SelectListItem> {
                new SelectListItem {
                    Text = "en", Value = "en"
                },
                new SelectListItem {
                    Text = "ru", Value = "ru"
                },
                new SelectListItem {
                    Text = "am", Value = "am"
                },
            },
                                          "Value", "Text");
            return(View(project));
        }
        public async Task <ActionResult> Edit(TeamMember teamMember, HttpPostedFileBase file)
        {
            if (ModelState.IsValid)
            {
                TeamMember teamMemberEdit = new TeamMember
                {
                    TeamMemberID = teamMember.TeamMemberID,
                    Firstname    = teamMember.Firstname,
                    Lastname     = teamMember.Lastname,
                    Position     = teamMember.Position,
                    Lang         = teamMember.Lang,
                };
                if (file != null)
                {
                    var img = new Image {
                        ImageData = new byte[file.ContentLength], ImageMimeType = file.ContentType,
                    };
                    file.InputStream.Read(img.ImageData, 0, file.ContentLength);
                    teamMemberEdit.ImageId = await DbAdaptor.CreateImageAsync(img);
                }
                else
                {
                    teamMemberEdit.ImageId = imageId;
                }


                await DbAdaptor.EditTeamMemberAsync(teamMemberEdit);

                return(RedirectToAction("Index"));
            }

            ViewBag.Lang = new SelectList(new List <SelectListItem> {
                new SelectListItem {
                    Text = "en", Value = "en"
                },
                new SelectListItem {
                    Text = "ru", Value = "ru"
                },
                new SelectListItem {
                    Text = "am", Value = "am"
                },
            },
                                          "Value", "Text");
            return(View(teamMember));
        }