private string AddPublisher() { publisher publisher = (publisher)ObjectUtil.FillObjectWithMap(new publisher(), BaseService.ReqToDict(Request)); if (publisher != null) { PublisherService = new PublisherService(); publisher Std = null; if (StringUtil.NotNullAndNotBlank(publisher.id)) { Std = (publisher)PublisherService.Update(publisher); } else { Std = (publisher)PublisherService.Add(publisher); } if (Std == null) { return("0"); } publisher toSend = (publisher)ObjectUtil.GetObjectValues(new string[] { "id", "name", "address", "contact" }, Std); return(JsonConvert.SerializeObject(toSend)); } return("0"); }
public IActionResult Insert(PublisherInsertViewModel model) { var entity = _mapper.Map <Publisher>(model); var affectedRowsCount = _service.Add(entity); ViewData["AffectedRowsCount"] = affectedRowsCount; return(View(model)); }
public bool AddPublisher(PublisherData p) { return(PublisherService.Add(new Publisher() { ID = p.ID, name = p.name })); }
public IActionResult Add(AdminPublisherVM model) { if (ModelState.IsValid) { var entity = new Publisher(); entity.Name = model.Name; entity.Address = model.Address; _publisherService.Add(entity); return(View(model)); } else { return(View(model)); } }
public async override Task <bool> AddIfNotExists(CsvRowResult row) { PublisherService service = new PublisherService(); Publisher publisher = row.Entity as Publisher; if (await service.ExistsWithName(publisher.Name)) { return(false); } else { await service.Add(publisher); return(true); } }
public async Task Create_Test() { // arrange var fakeUowProvider = A.Fake <IUnitOfWorkProvider>(); var fakeRepoProvider = A.Fake <IPublisherRepositoryProvider>(); var fakeRepo = A.Fake <IPublisherRepository>(); var fakeUow = A.Fake <IUnitOfWork>(); A.CallTo(() => fakeUowProvider.Get()).Returns(fakeUow); A.CallTo(() => fakeRepoProvider.Get(fakeUow)).Returns(fakeRepo); PublisherService service = new PublisherService(fakeUowProvider, fakeRepoProvider); Publisher publisher = new Publisher("some_publisher"); // act await service.Add(publisher); // assert A.CallTo(() => fakeRepo.Create(publisher)).MustHaveHappened(); A.CallTo(() => fakeUow.Dispose()).MustHaveHappened(); }
public int Add(PLPublisher item) { if (PLValidation.IsItemNull(item)) { Console.WriteLine("Cant add null"); return(0); } int addResult = _curPublWorkerService.Add(new BLLPublisher { PublisherName = item.PublisherName, LicenseNumber = item.LicenseNumber }); if (addResult > 0) { Console.WriteLine($"Item {item.PublisherName} was added"); } else { Console.WriteLine($"Item add error"); } return(addResult); }
/// <summary> /// 添加 /// </summary> /// <param name="name"></param> /// <returns></returns> public int Add(string name) { return(ps.Add(name)); }
public IActionResult Post([FromBody] PostPublisherViewModel publisher) { _publisherService.Add(publisher); return(Ok()); }