コード例 #1
0
 public IActionResult Delete(mContractor contractor)
 {
     if (oContractor.DeleteUserFromId(contractorConsumer, contractor.Id))
     {
         return(RedirectToAction(nameof(Index)));
     }
     return(RedirectToAction(nameof(Index)));
 }
コード例 #2
0
 public IActionResult Edit(mContractor contractor)
 {
     if (ModelState.IsValid)
     {
         //Aktualny użytkownik
         contractor.ModifiedBy = 1;
         contractor.ModifiedAt = DateTime.Now;
         if (oContractor.SaveContractorFromViewModel <mContractor>(contractorConsumer, mapper, contractor))
         {
             return(RedirectToAction(nameof(Index)));
         }
     }
     return(View(contractor));
 }
コード例 #3
0
        public void Contractor_Create_Works_Good_Object()
        {
            //Arrnage
            var model = new mContractor
            {
                Pesel     = "123123",
                FirstName = "asdasd",
            };
            ContractorController contractorController = new ContractorController(contractorRepository.Object, Mapper.Instance);

            //Act
            var result = contractorController.Create(model);

            //Assert
            Assert.AreEqual(model.Pesel, contractorList.Last().Pesel);
        }