public JsonResult Save(DrugBrandViewModel model)
        {
            int saveIndex = 0;

            var _drugBrand = new DrugBrand();

            _drugBrand.BrandId     = model.BrandId;
            _drugBrand.Name        = model.Name;
            _drugBrand.Preparation = model.Preparation;
            _drugBrand.GenericId   = model.GenericId;
            saveIndex = model.BrandId == 0 ? DrugBrandManager.SaveDrugBrand(_drugBrand) : DrugBrandManager.EditDrugBrand(_drugBrand);
            //return saveIndex > 0 ? Reload(saveIndex) : ErroeMessageResult();
            return(Reload(saveIndex));
        }
Пример #2
0
        public DrugBrand GetBrandDrugById(int brandId)
        {
            var _drugBrand = new DrugBrand();

            try
            {
                _drugBrand = _drugBrandRepository.FindOne(x => x.BrandId == brandId);
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }
            return(_drugBrand);
        }
Пример #3
0
        //public List<DrugBrand> GetAllDrugBrand(int startPage, int _pageSize, out int totalrecords, DrugBrand model)
        //{
        //    List<DrugBrand> _drugBrands;

        //    try
        //    {
        //        _drugBrands = _drugBrandRepository.GetAllDrugBrand(startPage, _pageSize, out totalrecords, model);
        //    }
        //    catch (Exception exception)
        //    {

        //        throw new Exception(exception.Message);
        //    }
        //    return _drugBrands;
        //}
        public List <DrugBrand> GetAllDrugBrand(out int totalrecords, DrugBrand model)
        {
            List <DrugBrand> _drugBrands;

            try
            {
                _drugBrands = _drugBrandRepository.GetAllDrugBrand(out totalrecords, model);
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }
            return(_drugBrands);
        }
Пример #4
0
        public int SaveDrugBrand(DrugBrand _drugBrand)
        {
            int saveIndex = 0;

            try
            {
                _drugBrand.IsActive = true;
                saveIndex           = _drugBrandRepository.Save(_drugBrand);
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }
            return(saveIndex);
        }
Пример #5
0
        public int EditDrugBrand(DrugBrand _drugBrand)
        {
            int editIndex = 0;

            try
            {
                DrugBrand drugBrand = GetBrandDrugById(_drugBrand.BrandId);
                drugBrand.Name        = _drugBrand.Name;
                drugBrand.Preparation = _drugBrand.Preparation;
                drugBrand.GenericId   = _drugBrand.GenericId;
                editIndex             = _drugBrandRepository.Edit(drugBrand);
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }
            return(editIndex);
        }