public async Task <bool> Add(User user, Status status)
 {
     try
     {
         status.fk_UserId = user.Id;
         return(_statusRepository.Add(status));
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Пример #2
0
 public void AddStatus(Status status)
 {
     //status.Note = "0";
     status.isDelete = false;
     _statusRepository.Add(status);
     _unitOfWork.Commit();
 }
 public ActionResult Create(Status status)
 {
     status.Created       = DateTime.Now;
     status.Modified      = DateTime.Now;
     status.CreatedBy.ID  = 1;
     status.ModifiedBy.ID = 1;
     _status.Add(status);
     _status.Commit();
     return(RedirectToAction("Index"));
 }
Пример #4
0
 public void createStatus(Status obj)
 {
     try
     {
         StatusRepository.Add(obj);
         SaveChange();
     }
     catch
     {
     }
 }
Пример #5
0
 public ActionResult <StatusEntity> Post([FromBody] StatusEntity statusEntity)
 {
     if (!ValidaStatus(statusEntity))
     {
         statusEntity.nome = statusEntity.nome.Trim(' ');
         return(new OkObjectResult(_statusRepository.Add(statusEntity)));
     }
     else
     {
         return(new BadRequestObjectResult("Nome inválido!"));
     }
 }
Пример #6
0
        public IActionResult Create(Status status)
        {
            if (ModelState.IsValid)
            {
                var userId = _userManager.GetUserId(User);
                status.CreatedById  = userId;
                status.ModifiedById = userId;
                _status.Add(status);
                return(RedirectToAction("Index", "Status"));
            }

            return(View(status));
        }
Пример #7
0
        public IActionResult OnPost()
        {
            if (ModelState.IsValid)
            {
                var count = _statusRepository.Add(status);

                if (count > 0)
                {
                    Message = "Novo status incluído com sucesso !";
                    return(Redirect("/Status/Index"));
                }
            }

            return(Page());
        }
        public Status Registrar(string nome)
        {
            var status = new Status(nome);

            status.Registrar();

            if (Commit())
            {
                _repository.Add(status);

                return(status);
            }

            return(null);
        }
Пример #9
0
        public ActionResult <StatusEntity> Post([FromBody] StatusEntity status)
        {
            status.NOME = status.NOME.Trim(' ');
            if (String.IsNullOrEmpty(status.NOME))
            {
                return(BadRequest("Nome vazio"));
            }

            var nome = Validacoes.StringValidation(status.NOME);

            if (nome == true)
            {
                return(_statusRepository.Add(status));
            }
            else
            {
                return(BadRequest("Não foi possível atualizar este status. Por favor, digite um nome válido."));
            }
        }
Пример #10
0
        public object Post(Models.Status added)
        {
            object json;
            string messageError = "";

            try
            {
                Models.Status posted = repository.Add(added, ref messageError);

                if (posted != null)
                {
                    json = new
                    {
                        total   = 1,
                        data    = posted,
                        success = true
                    };
                }
                else
                {
                    json = new
                    {
                        message = messageError,
                        success = false
                    };
                };
            }
            catch (Exception ex)
            {
                LogManager.Write("ERROR:" + Environment.NewLine + "\tMETHOD = " + this.GetType().FullName + "." + MethodBase.GetCurrentMethod().Name + Environment.NewLine + "\tMESSAGE = " + ex.Message);

                object error = new { message = ex.Message };

                json = new
                {
                    message = ex.Message,
                    success = false
                };
            };

            return(json);
        }
        public async Task <bool> Add(StatusCreateDto model)
        {
            try
            {
                var cat = _mapper.Map <Status>(model);
                _repoStatus.Add(cat);
                await _repoStatus.SaveAll();

                var langs = model.Langs.Select(x => new StatusLang {
                    StatusID = cat.StatusID, Name = x.Name, LanguageID = x.LanguageID
                }).ToList();
                await _repoStatus.AddStatusLang(langs);

                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Пример #12
0
        public IActionResult StatusStore(Status request)
        {
            RequiredFields model = new RequiredFields();
            model.Status = request;
            //return Ok(model);
            object validateFields = _validationService.ValidateRequest("Status", model);
            if (JsonConvert.SerializeObject(validateFields).Length > 2)
                return BadRequest(validateFields);

            try
            {
                var response = _statusRepository.Add(request);
                if (response == true)
                    return Ok(new GenericResult { Response = response, Message = "Record has been successfully added" });
                else
                    return BadRequest(_Duplicate);
            }
            catch (Exception e)
            {
                return BadRequest(e);
            }
        }
Пример #13
0
 public Status Add(Status obj) => _statusRepository.Add(obj);
Пример #14
0
 public void Add(Status entity)
 {
     _statusService.Add(entity);
 }
 public long Add(Status obj)
 {
     return(_statusRepository.Add(obj));
 }
 public void Add(Status assetDetail)
 {
     repository.Add(assetDetail);
 }
Пример #17
0
 public void Add(DeliveryStatus status)
 {
     statusRepository.Add(status);
 }
Пример #18
0
 public Status Add(Status status)
 {
     return(_statusRepository.Add(status));
 }
Пример #19
0
        public StatusViewModel Add(StatusViewModel entity)
        {
            var status = _repo.Add(_mapper.Map <Status>(entity));

            return(_mapper.Map <StatusViewModel>(status));
        }
        public Status AddStatus(Status item)
        {
            var result = _statusRepository.Add(item);

            return(result);
        }