Ejemplo n.º 1
0
 public IActionResult Delete(mContractor contractor)
 {
     if (oContractor.DeleteUserFromId(contractorConsumer, contractor.Id))
     {
         return(RedirectToAction(nameof(Index)));
     }
     return(RedirectToAction(nameof(Index)));
 }
Ejemplo n.º 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));
 }
        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);
        }