public async Task <string> DeleteBannerAsync(long BannerID)
        {
            try
            {
                utblMstBanner curObj = await objDB.utblMstBanners.FindAsync(BannerID);

                objDB.utblMstBanners.Remove(curObj);
                await objDB.SaveChangesAsync();

                return("Banner Details Removed");
            }
            catch (SqlException ex)
            {
                if (ex.Errors.Count > 0) // Assume the interesting stuff is in the first error
                {
                    switch (ex.Errors[0].Number)
                    {
                    case 547:     // Foreign Key violation
                        return("This record has dependencies on other records, so cannot be removed.");

                    default:
                        return("Error: " + ex.Message);
                    }
                }
                return("Error while operation. Error Message: " + ex.Message);
            }
            catch (Exception ex)
            {
                return("Error: " + ex.Message);
            }
        }
        public async Task <utblMstBanner> GetBannerByIDAsync(long id)
        {
            utblMstBanner obj = new utblMstBanner();

            obj = await objDB.utblMstBanners.Where(x => x.BannerID == id).FirstOrDefaultAsync();

            return(obj);
        }
        public async Task <string> SaveBanner(utblMstBanner model)
        {
            if (ModelState.IsValid)
            {
                return(await objDal.SaveBannerAsync(model));
            }
            string messages = string.Join("; ", ModelState.Values
                                          .SelectMany(x => x.Errors)
                                          .Select(x => x.ErrorMessage));

            return("Operation Error: " + messages);
        }
        public async Task <string> SaveBannerAsync(utblMstBanner model)
        {
            try
            {
                var parPID   = new SqlParameter("@BannerID", model.BannerID);
                var parIName = new SqlParameter("@BannerPath", model.BannerPath);

                return(await objDB.Database.SqlQuery <string>("udspMstBannerAddEdit @BannerID, @BannerPath",
                                                              parPID, parIName).FirstOrDefaultAsync());
            }
            catch (Exception ex)
            {
                return("Error: " + ex.Message);
            }
        }