Пример #1
0
        public virtual ActionResult Create(Transporter transporter)
        {
            if (_transporterService.IsNameValid(transporter.TransporterID,transporter.Name))
            {
                 ModelState.AddModelError("Name", "Transporter Name should be Unique");
            }
            if (ModelState.IsValid)
            {
                _transporterService.AddTransporter(transporter);
                return Json(new {sucess=true});
            }
            return PartialView(transporter);

            //if (!repository.Transporter.IsNameValid(transporter.TransporterID, transporter.Name))
            //{
            //    ModelState.AddModelError("Name", "Transporter Name should be Unique");
            //}
            //if (ModelState.IsValid)
            //{
            //    repository.Transporter.Add(transporter);
            //    return Json(new { success = true });
            //}

            //return PartialView(transporter);
        }
Пример #2
0
 public bool DeleteTransporter(Transporter entity)
 {
     if(entity==null) return false;
        _unitOfWork.TransporterRepository.Delete(entity);
        _unitOfWork.Save();
        return true;
 }
Пример #3
0
 public bool EditTransporter(Transporter entity)
 {
     _unitOfWork.TransporterRepository.Edit(entity);
        _unitOfWork.Save();
        return true;
 }