Example #1
0
        public bool UpdateEstablishmentCategory(EstablishmentCategoryModel establishmentCategory)
        {
            if (establishmentCategory.CategoryDescription == null)
            {
                throw new Exception("Erro ao processar, categoria vazia!");
            }

            _establishmentCategory.UpdateEstablishmentCategory(establishmentCategory);

            return(true);
        }
Example #2
0
        public int InsertEstablishmentCategory(EstablishmentCategoryModel establishmentCategory)
        {
            if (establishmentCategory.CategoryDescription == null)
            {
                throw new Exception("Erro ao processar, categoria vazia!");
            }

            var establishmentCategoryId = _establishmentCategory.InsertCategory(establishmentCategory);

            return(establishmentCategoryId);
        }
        public bool UpdateEstablishmentCategory(EstablishmentCategoryModel request)
        {
            #region .: Query :.
            var query = @"
                UPDATE [dbo].[EstablishmentCategory]
                    SET [CategoryDescription] = @CategoryDescription
                        WHERE [EstablishmentCategoryId] = @EstablishmentCategoryId";
            #endregion
            ExecuteQuery(query, ConnectionString, request);

            return(true);
        }
        public int InsertCategory(EstablishmentCategoryModel request)
        {
            #region .: Query :.
            var query = @"
                INSERT INTO [dbo].[EstablishmentCategory] 
                    ([CategoryDescription])
                        VALUES (@CategoryDescription)
                            SELECT CAST(SCOPE_IDENTITY() AS INT) [EstablishmentCategoryId]";
            #endregion
            var establishmentCategoryId = ExecuteGetObj <int>(query, ConnectionString, request);

            return(establishmentCategoryId);
        }
        public ActionResult DeleteEstablishment(EstablishmentCategoryModel establishmentCategory)
        {
            try
            {
                var sucess = _establishmentCategoryService.RemoveEstablishmentCategory(establishmentCategory);

                return(Ok(sucess));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
        public ActionResult CreateEstablishment([FromBody] EstablishmentCategoryModel establishmentCategory)
        {
            try
            {
                var id = _establishmentCategoryService.CreateEstablishmentCategory(establishmentCategory);

                return(Ok(new { Created = true, IdInsered = id }));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Example #7
0
        public bool RemoveEstablishmentCategory(EstablishmentCategoryModel establishmentCategory)
        {
            DeleteEstablishmentCategory(establishmentCategory.EstablishmentCategoryId);

            return(true);
        }
Example #8
0
        public bool SaveEstablishmentCategory(EstablishmentCategoryModel establishmentCategory)
        {
            UpdateEstablishmentCategory(establishmentCategory);

            return(true);
        }
Example #9
0
        public int CreateEstablishmentCategory(EstablishmentCategoryModel establishmentCategory)
        {
            establishmentCategory.EstablishmentCategoryId = InsertEstablishmentCategory(establishmentCategory);

            return(establishmentCategory.EstablishmentCategoryId);
        }