Exemple #1
0
        public async Task <ActionResult <IEnumerable <GenericElementGenericChore> > > GetGenericElementGenericTasks()
        {
            var x = _genericElementGenericChoresService.GetAll().ToList().Count();

            if (x == 0)
            {
                var a = new GenericElementGenericChore
                {
                    Id = Guid.Parse("4dd0bf98-917b-4a3e-9777-10f2220236ea"),
                    GenericElementId = Guid.Parse("0112a310-89ca-49aa-b57b-3236b51d0cc4"),
                    GenericChoreId   = Guid.Parse("4d84fb9e-14f8-40a5-8ab8-2a62c172ab22"),
                    Status           = Status.Active
                };

                var b = new GenericElementGenericChore
                {
                    Id = Guid.Parse("796fccb6-aecd-41ee-b5ac-6bb1e3eda7c9"),
                    GenericElementId = Guid.Parse("72589b7d-8434-4891-a26f-8df530a3e913"),
                    GenericChoreId   = Guid.Parse("19b0720a-aba5-4566-bd2e-53dcf08baa08"),
                    Status           = Status.Active,
                };
                _genericElementGenericChoresService.Add(a);
                _genericElementGenericChoresService.Add(b);
            }

            return(await _genericElementGenericChoresService.GetAll().ToListAsync());
        }
Exemple #2
0
        public async Task <ActionResult <IEnumerable <Floor> > > GetFloors()
        {
            var x = _floorsService.GetAll().ToList().Count();

            if (x == 0)
            {
                var a = new Floor
                {
                    Id         = Guid.Parse("de579db4-6927-479c-824a-a3fb20031f39"),
                    BuildingId = Guid.Parse("a0b03150-18b2-4c80-aea0-d615983d8dd6"),
                    Ref        = "F1",
                    Name       = "Auditoria"
                };

                var b = new Floor
                {
                    Id         = Guid.Parse("0433bd95-532f-43f5-ab33-994f613b7530"),
                    BuildingId = Guid.Parse("a23fdd96-9fd3-4e28-b48a-ee4f237d2fef"),
                    Ref        = "F1",
                    Name       = "Rosas"
                };
                _floorsService.Add(a);
                _floorsService.Add(b);
            }

            return(await _floorsService.GetAll().ToListAsync());
        }
Exemple #3
0
        public async Task <ActionResult <IEnumerable <ElementType> > > GetElementTypes()
        {
            var x = _elementTypesService.GetAll().ToList().Count();

            if (x == 0)
            {
                var a = new ElementType
                {
                    Id   = Guid.Parse("9cdbc1c0-a419-4117-af42-30b289c50a67"),
                    Ref  = "1",
                    Name = "Elemento",
                };

                var b = new ElementType
                {
                    Id   = Guid.Parse("c57057d2-0802-4522-95a2-0b20cabfcaeb"),
                    Ref  = "2",
                    Name = "Legionela",
                };
                _elementTypesService.Add(a);
                _elementTypesService.Add(b);
            }

            return(await _elementTypesService.GetAll().ToListAsync());
        }
Exemple #4
0
        public async Task <ActionResult <IEnumerable <GenericChore> > > GetGenericChores()
        {
            var x = _genericChoresService.GetAll().ToList().Count();

            if (x == 0)
            {
                var a = new GenericChore
                {
                    Id          = Guid.Parse("4d84fb9e-14f8-40a5-8ab8-2a62c172ab22"),
                    Description = "Limpiar filtros",
                    Duration    = TimeSpan.Zero,
                    ChoreTypeId = Guid.Parse("137d2d2c-f24c-40fd-842e-e055ef9433d7"),

                    CategoryId = Guid.Parse("7bd26acc-8e68-45e6-bc9d-17ef00e69f4a"),
                };

                var b = new GenericChore
                {
                    Id          = Guid.Parse("19b0720a-aba5-4566-bd2e-53dcf08baa08"),
                    Description = "Limpieza general",
                    Duration    = TimeSpan.Zero,
                    ChoreTypeId = Guid.Parse("d522d22b-641c-4d8c-bf36-b30343d9955d"),

                    CategoryId = Guid.Parse("a1537944-006c-4144-974a-3aaf9719518e"),
                };
                _genericChoresService.Add(a);
                _genericChoresService.Add(b);
            }

            return(await _genericChoresService.GetAll().ToListAsync());
        }
Exemple #5
0
        public async Task <ActionResult <IEnumerable <GenericElement> > > GetGenericElements()
        {
            var x = _genericElementsService.GetAll().ToList().Count();

            if (x == 0)
            {
                var a = new GenericElement
                {
                    Id            = Guid.Parse("72589b7d-8434-4891-a26f-8df530a3e913"),
                    ElementTypeId = Guid.Parse("c57057d2-0802-4522-95a2-0b20cabfcaeb"),
                    Name          = "Caldera",
                };

                var b = new GenericElement
                {
                    Id            = Guid.Parse("0112a310-89ca-49aa-b57b-3236b51d0cc4"),
                    ElementTypeId = Guid.Parse("9cdbc1c0-a419-4117-af42-30b289c50a67"),
                    Name          = "Ordenador",
                };
                _genericElementsService.Add(a);
                _genericElementsService.Add(b);
            }

            return(await _genericElementsService.GetAll().ToListAsync());
        }
Exemple #6
0
        public async Task <ActionResult <IEnumerable <Area> > > GetAreas()
        {
            var x = _areasService.GetAll().ToList().Count();

            if (x == 0)
            {
                var a = new Area
                {
                    Id          = Guid.Parse("60e7806c-dc43-4ff9-8f7b-b18b97d0ec0f"),
                    FloorId     = Guid.Parse("de579db4-6927-479c-824a-a3fb20031f39"),
                    Ref         = "I1",
                    Name        = "MT-BCN",
                    Description = "asdjklñqwe"
                };

                var b = new Area
                {
                    Id          = Guid.Parse("fdb3bb2c-adc0-4692-865c-7dbc7aa1c97f"),
                    FloorId     = Guid.Parse("0433bd95-532f-43f5-ab33-994f613b7530"),
                    Ref         = "I2",
                    Name        = "MA",
                    Description = "yurtuyjhfgj"
                };
                _areasService.Add(a);
                _areasService.Add(b);
            }

            return(await _areasService.GetAll().ToListAsync());
        }
Exemple #7
0
        public async Task <ActionResult <IEnumerable <Building> > > GetBuildings()
        {
            var x = _buildingsService.GetAll().ToList().Count();

            if (x == 0)
            {
                var a = new Building
                {
                    Id             = Guid.Parse("a0b03150-18b2-4c80-aea0-d615983d8dd6"),
                    InstallationId = Guid.Parse("d24ab749-87e9-43a9-9c7f-70d7021e5c83"),
                    Ref            = "B1",
                    Name           = "Oficinas",
                    Description    = "qwerty",
                };

                var b = new Building
                {
                    Id             = Guid.Parse("a23fdd96-9fd3-4e28-b48a-ee4f237d2fef"),
                    InstallationId = Guid.Parse("ce7fa284-7452-4c0a-acd4-ffa9f2360803"),
                    Ref            = "B1",
                    Name           = "Paz",
                    Description    = "Lorem ipsum"
                };
                _buildingsService.Add(a);
                _buildingsService.Add(b);
            }

            return(await _buildingsService.GetAll().ToListAsync());
        }
Exemple #8
0
 public IActionResult Create([FromBody] Mecanicos model)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     MecanicosService.Add(model);
     return(Ok());
 }
 public IActionResult Create([FromBody] Mantenimiento model)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     MantenimientoService.Add(model);
     return(Ok());
 }
 public IActionResult Create([FromBody] Area_Reparacion model)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     _Area_ReparacionServices.Add(model);
     return(Ok());
 }
 public IActionResult Create([FromBody] Vehiculo model)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     _empleadoServices.Add(model);
     return(Ok());
 }
Exemple #12
0
 public IActionResult Create([FromBody] Factura model)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     FacturaService.Add(model);
     return(Ok());
 }
Exemple #13
0
 public IActionResult Create([FromBody] Empleado_Atiende model)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     Empleado_AtiendeServices.Add(model);
     return(Ok());
 }
 public IActionResult Create([FromBody] Cliente model)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     ClienteServices.Add(model);
     return(Ok());
 }
Exemple #15
0
 public IActionResult Create([FromBody] Departamentos model)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     DepartamentosServices.Add(model);
     return(Ok());
 }
        public ActionResult <AddModel <T> > Add()
        {
            try
            {
                return(Ok(_service.Add()));
            }

            catch (Exception exception)
            {
                ModelState.AddModelError("ErrorMessage", exception.Message);
                return(BadRequest(ModelState));
            }
        }
Exemple #17
0
        private void InsertInDb()
        {
            Location = ItemLocation.Inventory;
            ItemContract contract = MapItemModel();

            _itemCrudService.Add(contract);
        }
Exemple #18
0
        public CrudModule(IDataContext dataContext, IValidator widgetValidator, IEventHub eventHub, ICrudService crudService, ISettings settings)
        {
            Post($"/api/v1/{settings.EntityName}/", async parameters =>
            {
                var rtn = await crudService.Add(dataContext, MakeModel(), widgetValidator);
                if (rtn.Success)
                {
                    await eventHub.OnCreated(rtn.Result);
                }
                return(rtn);
            });

            Put($"/api/v1/{settings.EntityName}/", async parameters =>
            {
                var rtn = await crudService.Update(dataContext, MakeModel(), widgetValidator);
                if (rtn.Success)
                {
                    await eventHub.OnUpdated(rtn.Result);
                }
                return(rtn);
            });

            Delete($"/api/v1/{settings.EntityName}/", async parameters =>
            {
                var rtn = await crudService.Delete(dataContext, MakeModel(), widgetValidator);
                if (rtn.Success)
                {
                    await eventHub.OnDeleted(rtn.Result);
                }
                return(rtn);
            });
        }
Exemple #19
0
        public Record Add(MultimediaDto dto)
        {
            var hash = HashImageAndSaveInServer(dto.Base64);
            Map map  = CreateMap(hash, dto);

            return(_mapsService.Add(map));
        }
        public async Task <IActionResult> Register(RegisterModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View());
            }

            var user = await _userManager.FindByNameAsync(model.UserName);

            if (user != null)
            {
                return(View("Success"));
            }

            user = new User
            {
                UserName = model.UserName,
                Email    = model.UserName,
            };

            var result = await _userManager.CreateAsync(user, model.Password);

            if (!result.Succeeded)
            {
                foreach (var error in result.Errors)
                {
                    ModelState.AddModelError(string.Empty, error.Description);
                }

                return(View());
            }

            var token = await _userManager.GenerateEmailConfirmationTokenAsync(user);

            var confirmationEmail = Url.Action("ConfirmEmailAddress", "Account",
                                               new { token = token, email = user.Email }, Request.Scheme);

            _emailMessageService.Add(new EmailMessage
            {
                From    = string.Empty,
                To      = user.Email,
                Subject = "Confirmation Email",
                Body    = string.Format("Confirmation Email: {0}", confirmationEmail),
            });

            return(View("Success"));
        }
Exemple #21
0
 public async Task <ActionResult <InstallationUser> > PostInstallationUser(InstallationUser installationUser)
 {
     return(await Task.Run(() =>
     {
         var output = _installationUsersService.Add(installationUser);
         return new ActionResult <InstallationUser>(output);
     }));
 }
Exemple #22
0
 public async Task <ActionResult <Client> > PostClient(Client client)
 {
     return(await Task.Run(() =>
     {
         var output = _clientsService.Add(client);
         return new ActionResult <Client>(output);
     }));
 }
Exemple #23
0
 public async Task <ActionResult <Book> > PostBook(Book book)
 {
     return(await Task.Run(() =>
     {
         var output = _booksService.Add(book);
         return new ActionResult <Book>(output);
     }));
 }
 public async Task <ActionResult <OrderItem> > PostBook(OrderItem orderitems)
 {
     return(await Task.Run(() =>
     {
         var output = _orderitemsService.Add(orderitems);
         return new ActionResult <OrderItem>(output);
     }));
 }
Exemple #25
0
 public async Task <ActionResult <GenericChoreFormatLabel> > PostGenericChoreFormatLabel(GenericChoreFormatLabel elementGenericTask)
 {
     return(await Task.Run(() =>
     {
         var output = _genericChoreFormatLabelsService.Add(elementGenericTask);
         return new ActionResult <GenericChoreFormatLabel>(output);
     }));
 }
 public async Task <ActionResult <Employee> > PostBook(Employee employee)
 {
     return(await Task.Run(() =>
     {
         var output = _employeesService.Add(employee);
         return new ActionResult <Employee>(output);
     }));
 }
Exemple #27
0
 public async Task <ActionResult <Element> > PostElement(Element element)
 {
     return(await Task.Run(() =>
     {
         var output = _elementsService.Add(element);
         return new ActionResult <Element>(output);
     }));
 }
        public HttpResponseMessage Add([FromBody] T entity)
        {
            crudService.Add(entity);

            var response = Request.CreateResponse(HttpStatusCode.Created, entity);

            return(response);
        }
Exemple #29
0
 public async Task <ActionResult <FormatValue> > PostFormat(FormatValue format)
 {
     return(await Task.Run(() =>
     {
         var output = _formatValuesService.Add(format);
         return new ActionResult <FormatValue>(output);
     }));
 }
Exemple #30
0
 public async Task <ActionResult <ElementGenericChore> > PostElementGenericChore(ElementGenericChore elementGenericTask)
 {
     return(await Task.Run(() =>
     {
         var output = _elementGenericChoresService.Add(elementGenericTask);
         return new ActionResult <ElementGenericChore>(output);
     }));
 }