Example #1
0
        public async Task <IActionResult> CreateErrand([FromBody] CreateErrandViewModel model)
        {
            if (await _identity.CreateErrandAsync(model))
            {
                return(new OkResult());
            }

            return(new BadRequestResult());
        }
Example #2
0
        public async Task <bool> CreateErrandAsync(CreateErrandViewModel model)
        {
            try
            {
                var errand = new Errand()
                {
                    CustomerName = model.CustomerName,
                    UserId       = model.UserId,
                    Created      = model.Created,
                    Status       = model.Status,
                    Description  = model.Description
                };
                _context.Errands.Add(errand);
                await _context.SaveChangesAsync();

                return(true);
            }
            catch { }

            return(false);
        }