public ActionResult EditAuthor(int id, AuthorModel model) { SessionModelCollector sessionModel = this.GetFromSession <SessionModelCollector>("ProjectInfo"); sessionModel.Authors[id] = model; this.AddToSession("ProjectInfo", sessionModel); //save in session return(RedirectToAction("AuthorList")); }
public ViewResult CreateAuthor() { ViewBag.Title = "Library :: Авторы"; ViewBag.Caption = "Создать автора"; AuthorModel author = new AuthorModel(); return(View("AuthorForm", author)); }
public ActionResult IndexO() { var list = new AuthorModel(); list.AllCampus = GetCampus(); list.AllAuthor = GetA(); return(View(list)); }
public AuthorModelTests() { _repositoryMock = new Mock <IAuthorRepository>(); _dateValidatorMock = new Mock <IDateValidator>(); _pageValidatorMock = new Mock <IPageValidator>(); _model = new AuthorModel(_repositoryMock.Object, _dateValidatorMock.Object, _pageValidatorMock.Object); }
public ActionResult CreateAuthor() { var record = new AuthorModel(); record.AllLocations = GetLocation(); record.EventHandlers = GetHandler(); return(View(record)); }
private void AuthorSelectorLB_SelectionChanged(object sender, SelectionChangedEventArgs e) { SelectedAuthor = _authorTable.ConvertDataRowToAuthor(_authors[AuthorSelectorLB.SelectedIndex]); TB_SelectAuthorFirstName.Text = SelectedAuthor.FirstName; TB_SelectAuthorLastName.Text = SelectedAuthor.LastName; TB_SelectAuthorMiddleName.Text = SelectedAuthor.MiddleName; Close(); }
public CreateBlog() { Model.AuthorModel FristAuthor = new AuthorModel() { Given_name = "Richard", Last_name = "Flow", Birth_date = new DateTime(1990, 06, 27), Email = "*****@*****.**", Website = "www.abc.com", Phone = "8888554455", Country = "Canada", Province = "Ontario", Postal_code = "1424115" }; Model.AuthorModel SecondAuthor = new AuthorModel() { Given_name = "Richard", Last_name = "Jhnonson", Birth_date = new DateTime(1992, 06, 27), Email = "*****@*****.**", Website = "www.abc1.com", Phone = "8888554465", Country = "US", Province = "ANY", Postal_code = "1524115" }; Model.AuthorModel ThirdAuthor = new AuthorModel() { Given_name = "Michael", Last_name = "Jhnonson", Birth_date = new DateTime(1980, 06, 27), Email = "*****@*****.**", Website = "www.abc12.com", Phone = "88885544652", Country = "India", Province = "ANY1", Postal_code = "15241152" }; Model.AuthorModel FourthAuthor = new AuthorModel() { Given_name = "Stephen", Last_name = "Jhnonson", Birth_date = new DateTime(1982, 06, 27), Email = "*****@*****.**", Website = "www.abc121.com", Phone = "888855446521", Country = "Pakistan", Province = "Baluchistan", Postal_code = "152141152" }; Authors.Add(FristAuthor); Authors.Add(SecondAuthor); Authors.Add(ThirdAuthor); Authors.Add(FourthAuthor); }
public ActionResult AddBook(BOOK book, List <int> Authors, List <int> Categories, List <HttpPostedFileBase> bookImages, List <HttpPostedFileBase> bookSoftCopy) { try { book.CREATED_DATE = DateTime.Now; book = BookModel.AddBook(book); foreach (int aID in Authors) { BOOK_AUTHOR bookAuthor = new BOOK_AUTHOR(); bookAuthor.BOOKID = book.BOOKID; bookAuthor.AUTHORID = aID; AuthorModel.AddBookAuthor(bookAuthor); } foreach (int bCID in Categories) { BOOK_CATEGORY bookCat = new BOOK_CATEGORY(); bookCat.BOOKID = book.BOOKID; bookCat.CATEGORYID = bCID; CategoryModel.AddBookCategory(bookCat); } foreach (HttpPostedFileBase image in bookImages) { String fname = Generator.RandomString(10) + "." + image.FileName.Split('.')[image.FileName.Split('.').Length - 1]; string path = Server.MapPath("~/UserImages/") + fname; BOOK_IMAGE bookImage = new BOOK_IMAGE(); bookImage.BOOKID = book.BOOKID; bookImage.IMAGEPATH = "/UserImages/" + fname; image.SaveAs(path); BookModel.AddBookImage(bookImage); } if (bookSoftCopy != null) { foreach (HttpPostedFileBase bookSC in bookSoftCopy) { String fname = Generator.RandomString(10) + "." + bookSC.FileName.Split('.')[bookSC.FileName.Split('.').Length - 1]; string path = Server.MapPath("~/UserImages/") + fname; BOOK_SOFTCOPY bSC = new BOOK_SOFTCOPY(); bSC.BOOKID = book.BOOKID; bSC.FILEPATH = "/UserImages/" + fname; bSC.FILESIZE = bookSC.ContentLength; bookSC.SaveAs(path); BookModel.AddBookSoftCopy(bSC); } } ViewBag.Message = SuccessMessage.BOOK_ADDED; } catch (Exception e) { ViewBag.Message = e.Message; } initialiseViewBag(); return(View(book)); }
// PUT api/values/id public void Put(int id, [FromBody] AuthorModel author) { client.UpdateAuthor(new Author { Id = id, AuthorName = author.AuthorName, AuthorSurname = author.AuthorSurname }); }
public async Task <IReadOnlyList <BookModel> > GetBooks(AuthorModel authorModel, BookByIdDataLoader dataLoader, [ScopedService] LibraryDbContext context, CancellationToken cancellationToken) { int[] bookIds = await context.Books .Where(x => x.AuthorId == authorModel.Id) .Select(x => x.Id) .ToArrayAsync(); return(await dataLoader.LoadAsync(bookIds, cancellationToken)); }
public JsonResult ChangeStatus(int ID) { var res = new AuthorModel().ChangeStatusAtID(ID); return(Json(new { status = res })); }
public int AddNewAuthor(AuthorModel model) { var authorEntity = Mapper.Map <AuthorModel, Author>(model); var addedEntity = _bookContext.Authors.Add(authorEntity); _bookContext.SaveChanges(); return(addedEntity.Id); }
// GET: AuthorModels/Create public ActionResult Create(AuthorModel authorModel) { AuthorViewModel vm = new AuthorViewModel(); //vm.Name = "111"; return(View()); //return new RedirectResult(Url.Action("PartialView", "Home", vm.Name)); // return RedirectToAction("PartialView", "Home", new { selectedRegionName= vm.Name }); }
public async Task UpdateAuthor(int libraryId, AuthorModel author, CancellationToken cancellationToken) { using (var connection = _connectionProvider.GetConnection()) { var sql = @"Update Author Set Name = @Name, Description = @Description, ImageId = @ImageId, AuthorType = @AuthorType Where Id = @Id AND LibraryId = @LibraryId"; var command = new CommandDefinition(sql, new { Id = author.Id, LibraryId = libraryId, Name = author.Name, Description = author.Description, ImageId = author.ImageId, AuthorType = (int)author.AuthorType }, cancellationToken: cancellationToken); await connection.ExecuteScalarAsync <int>(command); } }
public async Task <AuthorModel> DeleteAuthor(int id, [ScopedService] LibraryDbContext context) { AuthorModel authorModel = await context.Authors.FindAsync(id); context.Authors.Remove(authorModel); await context.SaveChangesAsync(); return(authorModel); }
// GET: Author/Delete/5 public ActionResult Delete(int id) { if (AuthorModel.Filter(id) == null) { return(HttpNotFound()); } AuthorModel.Delete(id); return(null); }
public static AuthorView Map(this AuthorModel source) => source == null ? null : new AuthorView { Id = source.Id, Name = source.Name, Description = source.Description, BookCount = source.BookCount, AuthorType = source.AuthorType.ToDescription() };
public void InsertUser(AuthorModel model) { string query = "INSERT INTO Authors VALUES(@FullName)"; var parameters = new Dictionary <string, object> { { "@FullName", model.FullName }, }; ExecuteNonQuery(query, parameters); }
public void AddAuthor(AuthorModel author) { Author new_author = new Author(); new_author.Name = author.Name; new_author.Birth_year = author.Birth_year; new_author.Deceased = author.Deceased; repositoryWrapper.AuthorRepository.Create(new_author); }
private void LB_SeriesSelector_SelectionChanged(object sender, SelectionChangedEventArgs e) { AuthorModel selectedAuthor = newBook.AuthorInfo as AuthorModel; if (selectedAuthor != null && selectedAuthor.IsValid) { newBook.SeriesInfo = new SeriesModel(selectedAuthor, LB_SeriesSelector.SelectedValue.ToString()); } }
private void SetAuthorNameValues() { AuthorModel selectedAuthor = ThisBook.AuthorInfo; TB_SelectAuthorFirstName.Text = selectedAuthor.FirstName; TB_SelectAuthorLastName.Text = selectedAuthor.LastName; TB_SelectAuthorMiddleName.Text = selectedAuthor.MiddleName; PopulateSeriesSelector(); }
public ActionResult UpdateAuthor(AuthorModel model, int AuthorID) { AuthorModelVM list = new AuthorModelVM(authBusLay.GetAuthorPassThru()); ViewBag.Author = new SelectList(list.ListOfAuthorModel, "AuthorID"); model.AuthorID = AuthorID; return(View(model)); }
public IActionResult Put([FromBody] AuthorModel updatedAuthor) { var author = _authorService.Update(updatedAuthor.ToDomainModel()); if (author == null) { return(BadRequest()); } return(Ok(author)); }
public static Author MapAuthorModel(AuthorModel author) { Author authorEntity = new Author { AuthorID = author.AuthorID, Name = author.Name, }; return(authorEntity); }
public StorySent(long storyId, AuthorModel author, string title, IEnumerable <string> tags, DateTime createdAt, VisibilityModel visibility) { StoryId = storyId; Author = author; Title = title; Tags = tags; CreatedAt = createdAt; Visibility = visibility; }
public ActionResult Author(Guid id) { AuthorModel model = DataService.GetAuthor(id, User.UserId); if (model == null) { return(new HttpNotFoundResult()); } return(View(model)); }
public void Map(AuthorModel from, Author to) { if (to.Id != from.Id) { throw new ArgumentException("Cannot map. Object are not related"); } to.Name = from.Name; to.Surname = from.Surname; to.Parentname = from.Parentname; }
public AuthorModel GetModel() { var author = new AuthorModel { Id = Faker.RandomNumber.Next(1, 100), Name = Faker.Name.FullName() }; return(author); }
public IActionResult Put(int id, [FromBody] AuthorModel updatedAuthor) { var author = _AuthorService.Update(updatedAuthor.ToDomainModel()); if (author == null) { return(NotFound()); } return(Ok(author)); }
// GET: Author/Details/5 public ActionResult Details(int id) { AUTHOR author = AuthorModel.Filter(id); if (author == null) { return(HttpNotFound()); } return(View(author)); }