Пример #1
0
        // GET: Authors/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }


            var author = _services.GetAuthorWithBooks((int)id);

            if (author == null)
            {
                return(HttpNotFound());
            }

            var model = Mapper.Map <AuthorDTO>(author);

            if (author.FileModelId != null)
            {
                model.FileModel = _fileServices.Get((int)author.FileModelId);
            }

            return(View(model));
        }