public virtual ActionResult Update(AboutUs model)
 {
     if (!ModelState.IsValid)
         return View(model);
     var result = _aboutUsService.Update(model);
     this.NotificationController().Notify(result.Message, NotificationStatus.Success);
     return View(model);
 }
 public IServiceResults<bool> Update(AboutUs model)
 {
     _aboutUs.Attach(model);
     _uow.Entry<AboutUs>(model).State = EntityState.Modified;
     var result = _uow.SaveChanges();
     return new ServiceResults<bool>()
     {
         IsSuccessfull = result.ToBool(),
         Message = result.ToBool() ? BusinessMessage.Ok : BusinessMessage.Error,
         Result = result.ToBool()
     };
 }
Example #3
0
        // GET: manage/AboutUs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AboutUs aboutUs = db.AboutUs.Find(id);

            if (aboutUs == null)
            {
                return(HttpNotFound());
            }
            return(View(aboutUs));
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (!IsPostBack)
         {
             string  Lang      = Globals.GetLang();
             AboutUs obj       = new AboutUs();
             int     AboutUsID = obj.GetFirstAboutUsID(Globals.AgentCatID, Lang);
             DataSet ds        = obj.GetAboutUsByArticleID("Article", AboutUsID, Lang);
             lblAboutUs.InnerHtml = DataObject.GetString(ds, 0, "Content");
         }
     }
     catch { }
 }
 public IActionResult Edit(AboutUs abs)
 {
     if (ModelState.IsValid)
     {
         abs.ModifiedBy = _admin.Fullname;
         AboutUs AboutUsToUpdate = _AboutUsRepository.GetAboutUsById(abs.Id);
         if (AboutUsToUpdate == null)
         {
             return(NotFound());
         }
         _AboutUsRepository.UpdateAboutUs(AboutUsToUpdate, abs);
         return(RedirectToAction("index"));
     }
     return(View(abs));
 }
Example #6
0
        public ActionResult SaveAbout(AboutUs abt)
        {
            var adminId = HttpContext.Session.GetInt32("Id");

            if (adminId.HasValue)
            {
                _context.Entry(abt).State = abt.Id > 0 ? EntityState.Modified : EntityState.Added;
                _context.SaveChanges();
                return(RedirectToAction("AddAbout"));
            }
            else
            {
                return(RedirectToAction("LogIn", "Admin"));
            }
        }
Example #7
0
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            AboutUs = await _context.AboutUs.FirstOrDefaultAsync(m => m.Id == id);

            if (AboutUs == null)
            {
                return(NotFound());
            }
            return(Page());
        }
        public ActionResult Save(AboutUs aboutUs)
        {
            if (aboutUs.ImgPath == null)
            {
                aboutUs.ImgPath = "";
            }
            var res = _aboutUsService.Save(aboutUs);

            return(Json(new Response
            {
                Success = res,
                Message = res ? Resource.SavedSuccessfully : Resource.ErrorsOccurred,
                Data = new { aboutUsID = aboutUs.Id }
            }));
        }
        public IActionResult Index()
        {
            if (!_loginServices.isInAdminRoles(this.GetRoles()))
            {
                return(RedirectToAction("Login", "Accounts"));
            }

            var model = this._context.AboutUss.FirstOrDefault();

            if (model == null)
            {
                model = new AboutUs();
            }
            return(View("AboutUs", model));
        }
Example #10
0
        public static bool UpdateAU(AboutUs au)
        {
            NGOEntities e    = new NGOEntities();
            var         item = e.AboutUs1.Find(au.ID);

            item.AboutName    = au.AboutName;
            item.AboutContent = au.AboutContent;
            item.AboutHide    = au.AboutHide;
            item.AboutImage   = au.AboutImage;
            if (e.SaveChanges() > 0)
            {
                return(true);
            }
            return(false);
        }
Example #11
0
        public async Task <IActionResult> Create([FromForm] AboutUsCreateViewModel vmItem)
        {
            // Invalid model
            if (!ModelState.IsValid)
            {
                return(View(vmItem));
            }

            // Get time stamp for table to handle concurrency conflict
            var tableName    = nameof(AboutUs);
            var tableVersion = await _context.TableVersion.FirstOrDefaultAsync(h => h.Id == tableName);

            // Trim white space



            // Create save db item
            var dbItem = new AboutUs
            {
                Id = Guid.NewGuid().ToString(),

                CreatedBy   = _loginUserId,
                CreatedDate = DateTime.Now,
                UpdatedBy   = null,
                UpdatedDate = null,
                RowStatus   = (int)AtRowStatus.Normal,
                RowVersion  = null,

                Title                = vmItem.Title,
                SlugTitle            = vmItem.SlugTitle,
                AutoSlug             = vmItem.AutoSlug,
                ShortDescriptionHtml = vmItem.ShortDescriptionHtml,
                LongDescriptionHtml  = vmItem.LongDescriptionHtml,
                ImageSlug            = vmItem.ImageSlug,
                Tags     = vmItem.Tags,
                KeyWord  = vmItem.KeyWord,
                MetaData = vmItem.MetaData,
                Note     = vmItem.Note,
            };

            _context.Add(dbItem);

            // Set time stamp for table to handle concurrency conflict
            tableVersion.LastModify = DateTime.Now;
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Details), new { id = dbItem.Id }));
        }
Example #12
0
        public IActionResult Save(AboutUsVM model)
        {
            AjaxMessage aMsg = new AjaxMessage();

            if (model != null)
            {
                if (ModelState.IsValid)
                {
                    var    files     = Request.Form.Files;
                    byte[] imageData = null;
                    if (files.Count > 0)
                    {
                        imageData = GetFormImageToByte(files[0]);
                    }

                    AboutUs aboutUs = new AboutUs();
                    aboutUs.Mission            = model.Mission;
                    aboutUs.Vision             = model.Vision;
                    aboutUs.Picture            = imageData != null ? imageData : model.Picture;
                    aboutUs.OperationDate      = DateTime.Now;
                    aboutUs.OperationIdUserRef = HttpRequestInfo.UserID;
                    aboutUs.OperationIP        = HttpRequestInfo.IpAddress;
                    aboutUs.OperationIsDeleted = 1;

                    if (model.IdAboutUs == 0)
                    {
                        _administrationBLLocator.AboutUsBL.CRUD.Insert(aboutUs);
                        _administrationBLLocator.AboutUsBL.Save();
                        aMsg.Status  = 1;
                        aMsg.Message = "Kayıt Başarıyla Eklendi.";
                    }
                    else
                    {
                        aboutUs.IdAboutUs = model.IdAboutUs;
                        _administrationBLLocator.AboutUsBL.CRUD.Update(aboutUs, HttpRequestInfo);
                        _administrationBLLocator.AboutUsBL.Save();
                        aMsg.Status  = 1;
                        aMsg.Message = "Güncelleme Başarılı.";
                    }
                }
                else
                {
                    aMsg.Status  = 0;
                    aMsg.Message = "Bir Hata oluştu";
                }
            }
            return(Json(aMsg));
        }
Example #13
0
 public void UpdateAboutUs(AboutUs about)
 {
     try
     {
         var a = _context.AboutUs.Find(about.Id);
         if (a != null)
         {
             a.Content = about.Content;
             _context.SaveChanges();
         }
     }
     catch
     {
         throw;
     }
 }
Example #14
0
 public AboutUsViewModel ConvertToViewModel(AboutUs entity)
 {
     if (entity == null)
     {
         return(new AboutUsViewModel());
     }
     else
     {
         return new AboutUsViewModel
                {
                    BodyHtml   = entity.BodyHtml,
                    CoverPhoto = entity.CoverPhoto,
                    Title      = entity.Title
                }
     };
 }
Example #15
0
        // GET: Admin/AboutUs/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AboutUs aboutUs = db.AboutUs.Find(id);

            if (aboutUs == null)
            {
                return(HttpNotFound());
            }
            db.AboutUs.Remove(aboutUs);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public ActionResult DetailsUser(int?id)
        {
            AboutUs aboutUs = new AboutUs();

            if (id == null)
            {
                aboutUs = db.AboutUs.Include(m => m.File).First();
                //return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            aboutUs = db.AboutUs.Include(m => m.File).FirstOrDefault(m => m.Id == id);
            if (aboutUs == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            return(View(aboutUs));
        }
 public IActionResult Edit(AboutUsViewModel abs)
 {
     if (ModelState.IsValid)
     {
         AboutUs model = _mapper.Map <AboutUsViewModel, AboutUs>(abs);
         model.ModifiedBy = _admin.FullName;
         AboutUs AboutUsToUpdate = _aboutUsRepository.GetAboutUsById(abs.Id);
         if (AboutUsToUpdate == null)
         {
             return(NotFound());
         }
         _aboutUsRepository.UpdateAboutUs(AboutUsToUpdate, model);
         return(RedirectToAction("index"));
     }
     return(Ok(abs));
 }
        public async Task <ActionResult <AboutUs> > Get(int id)
        {
            if (id == 0)
            {
                return(NotFound());
            }

            AboutUs data = await Repository.GetById(id);

            if (data == null)
            {
                return(NotFound());
            }

            return(data);
        }
Example #19
0
        public ActionResult Index(int?id, AboutUs about)
        {
            id = id == null ? 1 : id;
            AboutUs aboutUs = db.AboutUs.Find(id);

            if (aboutUs == null)
            {
                return(HttpNotFound());
            }


            Session["About"] = id;
            ViewBag.Page     = aboutUs.PageList;
            ViewBag.Content  = aboutUs.Content;
            return(View(db.AboutUs.ToList()));
        }
        public ActionResult CreateAbout(AboutUs a, HttpPostedFileBase imgAbout)
        {
            string FileName = DateTime.Now.Ticks + Path.GetFileName(imgAbout.FileName);
            string path     = Path.Combine(Server.MapPath("~/Images"), FileName);

            imgAbout.SaveAs(path);
            a.AboutImage = FileName;
            if (Repositories.CreateAU(a) == true)
            {
                TempData["success"] = "Create new about successfully!";
            }
            else
            {
                TempData["error"] = "Create new about failed!";
            }
            return(RedirectToAction("ListAbout"));
        }
    //--------------------------------------------------
    protected void addAboutUs(AboutUs about)
    {
        try
        {
            Open();
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = DataBase;
            //Procedure Name.
            cmd.CommandText = "add_New_About_US";
            cmd.CommandType = CommandType.StoredProcedure;
            //Procedure Parameters.
            cmd.Parameters.Add("@SiteId", SqlDbType.Int);
            cmd.Parameters.Add("@AbouOrdPos", SqlDbType.Int);
            cmd.Parameters.Add("@AbouTitle", SqlDbType.VarChar,250,"AbouTile");
            cmd.Parameters.Add("@AbouSubTitle", SqlDbType.VarChar,250,"AbouSubTitle");
            cmd.Parameters.Add("@AbouImage", SqlDbType.VarChar,250,"AbouImage");
            cmd.Parameters.Add("@AbouImageAlt", SqlDbType.VarChar,150,"AbouImageAlt");
            cmd.Parameters.Add("@AbouLink", SqlDbType.VarChar,250,"AbouLink");
            cmd.Parameters.Add("@AboutLink2", SqlDbType.VarChar,250,"AboutLink2");
            cmd.Parameters.Add("@AbouContent", SqlDbType.VarChar,20000,"AbouContent");
            cmd.Parameters.Add("@AbouState", SqlDbType.Bit);
            //Setting values to Parameters.
            cmd.Parameters[0].Value = about.SiteId;
            cmd.Parameters[1].Value = about.AbouOrdPos;
            cmd.Parameters[2].Value = about.AbouTitle;
            cmd.Parameters[3].Value = about.AbouSubTitle;
            cmd.Parameters[4].Value = about.AbouImage;
            cmd.Parameters[5].Value = about.AbouImageAlt;
            cmd.Parameters[6].Value = about.AbouLink;
            cmd.Parameters[7].Value = about.AbouLink2;
            cmd.Parameters[8].Value = about.AbouContent;
            cmd.Parameters[9].Value = about.AbouState;
            cmd.ExecuteNonQuery();
            Close();
        }
        catch (SqlException oSqlExp)
        {
            //Console.WriteLine("" + oSqlExp.Message);

        }
        catch (Exception oEx)
        {
            //Console.WriteLine("" + oEx.Message);

        }
    }
Example #22
0
        public void AddAboutUs(AboutUs value)
        {
            System.Data.SqlClient.SqlCommand    cmdSQL = null;
            System.Data.SqlClient.SqlConnection cnSQL  = null;

            string ConnString = System.Configuration.ConfigurationManager.ConnectionStrings["SteppingStoneDB"].ConnectionString;

            try
            {
                cnSQL = new System.Data.SqlClient.SqlConnection(ConnString);
                cnSQL.Open();
                cmdSQL             = new System.Data.SqlClient.SqlCommand();
                cmdSQL.Connection  = cnSQL;
                cmdSQL.CommandType = CommandType.Text;

                cmdSQL.CommandText = String.Format("INSERT INTO AboutUs (Title, Description) VALUES ('{0}', '{1}')", value.Title, value.Description);
                cmdSQL.ExecuteNonQuery();

                try
                {
                    MailMessage mail = new MailMessage();
                    //SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");

                    mail.From = new MailAddress("*****@*****.**");
                    mail.To.Add("*****@*****.**");
                    mail.Subject = "Test Mail";
                    mail.Body    = "This is for testing SMTP mail from Stepping Stone.org";

                    //SmtpClient smtp = new SmtpClient("m0#.internetmailserver.net");
                    SmtpClient smtp = new SmtpClient("m01.internetmailserver.net");

                    NetworkCredential Credentials = new NetworkCredential("*****@*****.**", "ssef@2020");
                    smtp.Credentials = Credentials;
                    //lblMessage.Text = "Mail Sent";

                    smtp.Send(mail);
                }
                catch (Exception ex)
                {
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Lấy tham số
            string ID = Request.QueryString["ID"].ToString();

            // Gán Mode: mã để trống-thêm mới, có mã-Chỉnh sửa
            if (ID == "")
            {
                M_Mode.Mode = Modes.INSERT;
            }
            else
            {
                M_Mode.Mode = Modes.EDIT;
            }

            if (!IsPostBack)
            {
                // Khởi tạo control
                this.txtIntroID.Enabled = false;

                // Lấy giá trị ban đầu
                if (M_Mode.Mode == Modes.EDIT)
                {
                    this.Page.Title         = "Cập nhập nội dung giới thiệu";
                    this.lbModeMessage.Text = "Cập nhập nội dung giới thiệu";

                    // Gán ID
                    this.txtIntroID.Text = ID;

                    // Lấy giá trị cho các control
                    AboutUs _obj = new AboutUs();
                    _obj.IntroID = Convert.ToInt32(this.txtIntroID.Text);

                    _obj = AboutUs.GetByID(_obj);

                    this.ckeDescription.Text = _obj.Description;
                    this.chkActive.Checked   = _obj.Active;
                }
                else if (M_Mode.Mode == Modes.INSERT)
                {
                    this.Page.Title          = "Thêm mới nội dung giới thiệu";
                    this.lbModeMessage.Text  = "Thêm mới nội dung giới thiệu";
                    this.ckeDescription.Text = "";
                }
            }
        }
Example #24
0
        private void onSettingsCommand(IUICommand command)
        {
            Rect windowBounds = Window.Current.Bounds;

            settingsPopup                       = new Popup();
            settingsPopup.Closed               += settingsPopup_Closed;
            Window.Current.Activated           += Current_Activated;
            settingsPopup.IsLightDismissEnabled = true;
            Page settingPage = null;

            switch (command.Id.ToString())
            {
            case "AU":
                settingPage = new AboutUs();
                break;

            case "PP":
                settingPage = new PrivacyPolicy();
                break;
            }
            settingsPopup.Width  = settingsWidth;
            settingsPopup.Height = windowBounds.Height;

            // Add the proper animation for the panel.
            settingsPopup.ChildTransitions = new TransitionCollection();
            settingsPopup.ChildTransitions.Add(new PaneThemeTransition()
            {
                Edge = (SettingsPane.Edge == SettingsEdgeLocation.Right) ?
                       EdgeTransitionLocation.Right :
                       EdgeTransitionLocation.Left
            });
            if (settingPage != null)
            {
                settingPage.Width  = settingsWidth;
                settingPage.Height = windowBounds.Height;
            }

            // Place the SettingsFlyout inside our Popup window.
            settingsPopup.Child = settingPage;

            // Let's define the location of our Popup.
            settingsPopup.SetValue(Canvas.LeftProperty, SettingsPane.Edge == SettingsEdgeLocation.Right ? (windowBounds.Width - settingsWidth) : 0);
            settingsPopup.SetValue(Canvas.TopProperty, 0);
            settingsPopup.IsOpen = true;
        }
        public List <AboutUs> MapAboutUs(DataTable tbl)
        {
            List <AboutUs> _List = new List <AboutUs>();

            foreach (DataRow row in tbl.Rows)
            {
                AboutUs aboutus = new AboutUs()
                {
                    Id          = Int32.Parse(row["Id"].ToString()),
                    Title       = row["Title"].ToString(),
                    Description = row["Description"].ToString()
                };

                _List.Add(aboutus);
            }

            return(_List);
        }
Example #26
0
        // GET: AboutUs
        public async Task <IActionResult> Index([FromRoute] string id)
        {
            AboutUs dbItem = null;

            if (!string.IsNullOrWhiteSpace(id))
            {
                dbItem = await _context.AboutUs.AsNoTracking().FirstOrDefaultAsync(h => h.Id == id);

                if (dbItem == null)
                {
                    return(NotFound());
                }
            }
            ViewData["ParentItem"] = dbItem;

            ViewData["ControllerNameForGrid"] = nameof(AboutUsController).Replace("Controller", "");
            return(View());
        }
Example #27
0
        public void UpdateAboutUsImage(int aboutUsId, string imageUrl)
        {
            try
            {
                AboutUs au = new AboutUs();
                using (VenturadaDataContext vdc = new VenturadaDataContext())
                {
                    au          = vdc.AboutUs.Single(a => a.AboutUsId == aboutUsId);
                    au.ImageUrl = imageUrl;

                    vdc.SubmitChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        AboutUs obj           = new AboutUs();
        string  CategoryName  = txtAboutUsCategoryName.Value.Trim();
        int     CategoryOrder = Convert.ToInt32(txtAboutUsCategoryOrder.Value);
        int     ModuleID      = 2;
        string  Action        = Globals.GetStringFromQueryString("Action");

        if (Action == "Edit") //Cập nhật
        {
            int CateID = Globals.GetIntFromQueryString("CateID");
            obj.UpdateAboutUsCategory(Globals.AgentCatID, CateID, Lang, CategoryName, CategoryOrder);
        }
        else //Thêm mới
        {
            obj.InsertAboutUsCategory(Lang, Globals.AgentCatID, CategoryName, CategoryOrder, ModuleID);
        }
    }
        public async Task SeedAsync(ApplicationDbContext dbContext, IServiceProvider serviceProvider)
        {
            if (!dbContext.AboutUs.Any())
            {
                var aboutUs = new AboutUs
                {
                    Email   = "*****@*****.**",
                    Phone   = "0888989844",
                    Address = "Цариградски комплекс Дружба 2 284, 1582 ж.к. Дружба 2, София",
                    LocationUrlForGoogleMaps =
                        "https://www.google.com/maps/place/Цариградски+Комплекс+Бл.284/@@42.6469796,23.4019008,15z/data=!4m5!3m4!1s0x0:0xf39840e6ad788839!8m2!3d42.6469796!4d23.4019008",
                    LocationUrlForOpenStreetMap =
                        "https://openstreetmap.org/export/embed.html?bbox=23.40328%2C42.64617%2C23.39128%2C42.64717&amp;layer=mapnik&amp;marker=42.64717%2C23.40128",
                };

                var result = await dbContext.AboutUs.AddAsync(aboutUs);
            }
        }
Example #30
0
        public AboutUs GetAllAboutUs()
        {
            var option = _option.ToList();

            AboutUs aboutusViewModel = new AboutUs();

            if (option.Where(x => x.Name == "TitleFa").Any())
            {
                aboutusViewModel.TitleFa = option.Where(x => x.Name == "TitleFa").FirstOrDefault().Value;
            }
            if (option.Where(x => x.Name == "BodyFa").Any())
            {
                aboutusViewModel.BodyFa = option.Where(x => x.Name == "BodyFa").FirstOrDefault().Value;
            }

            if (option.Where(x => x.Name == "TitleEn").Any())
            {
                aboutusViewModel.TitleEn = option.Where(x => x.Name == "TitleEn").FirstOrDefault().Value;
            }
            if (option.Where(x => x.Name == "BodyEn").Any())
            {
                aboutusViewModel.BodyEn = option.Where(x => x.Name == "BodyEn").FirstOrDefault().Value;
            }

            if (option.Where(x => x.Name == "TitleRu").Any())
            {
                aboutusViewModel.TitleRu = option.Where(x => x.Name == "TitleRu").FirstOrDefault().Value;
            }
            if (option.Where(x => x.Name == "BodyRu").Any())
            {
                aboutusViewModel.BodyRu = option.Where(x => x.Name == "BodyRu").FirstOrDefault().Value;
            }

            if (option.Where(x => x.Name == "TitleSa").Any())
            {
                aboutusViewModel.TitleSa = option.Where(x => x.Name == "TitleSa").FirstOrDefault().Value;
            }
            if (option.Where(x => x.Name == "BodySa").Any())
            {
                aboutusViewModel.BodySa = option.Where(x => x.Name == "BodySa").FirstOrDefault().Value;
            }

            return(aboutusViewModel);
        }
Example #31
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,LongDesc,File")] AboutUs aboutUs)
        {
            if (id != aboutUs.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    aboutUs.LongDesc.Trim();

                    string img = _context.AboutUs.AsNoTracking().FirstOrDefault()?.ImageURL;
                    if (aboutUs.ImageURL != null)
                    {
                        if (img != null && System.IO.File.Exists(img))
                        {
                            System.IO.File.Delete(img);
                        }
                    }
                    else
                    {
                        aboutUs.ImageURL = img;
                    }

                    _context.Update(aboutUs);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AboutUsExists(aboutUs.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(aboutUs));
        }
Example #32
0
        public ActionResult About(AboutUsInfo model)
        {
            AboutUs aboutUs   = new AboutUs();
            bool    returnVal = true;

            if (ModelState.IsValid)
            {
                if (model.AboutUsId > 0)
                {
                    returnVal = aboutUs.Set(model);
                }
                else
                {
                    returnVal = aboutUs.Insert(model);
                }
            }

            return(this.Json(returnVal, JsonRequestBehavior.AllowGet));
        }
        public async Task <AboutUs> GetById(int id)
        {
            // Initialzie new command obj.
            using SqlCommand aboutUsCommand = new SqlCommand()
                  {
                      CommandText = "proc_aboutus_get",
                      CommandType = CommandType.StoredProcedure,
                      Connection  = SqlDataAccess.Instance.GetSqlConnection
                  };

            // Define input parameters.
            aboutUsCommand.Parameters.AddWithValue("@id", id);

            // Open connection to database.
            SqlDataAccess.Instance.OpenConnection();

            // Initialzie new data reader.
            using SqlDataReader aboutUsDataReader = aboutUsCommand.ExecuteReader();

            // Define temporary type.
            AboutUs aboutUsObj = null;

            // Check if any rows.
            if (aboutUsDataReader.HasRows)
            {
                // Read data.
                while (await aboutUsDataReader.ReadAsync())
                {
                    aboutUsObj = new AboutUs()
                    {
                        BaseId              = aboutUsDataReader.GetInt32("Id"),
                        WelcomeMessage      = aboutUsDataReader.GetString("Welcome"),
                        Mission             = aboutUsDataReader.GetString("Mission"),
                        Vision              = aboutUsDataReader.GetString("Vision"),
                        RegisteredDateTime  = aboutUsDataReader.GetDateTime("AboutUsCreatedDate"),
                        LastUpdatedDateTime = aboutUsDataReader.GetDateTime("AboutUsUpdatedDate")
                    };
                }
            }

            // Return data ?? null if no rows.
            return(aboutUsObj);
        }
 /// <summary>
 /// There are no comments for AboutUs in the schema.
 /// </summary>
 public void AddToAboutUs(AboutUs aboutUs)
 {
     base.AddObject("AboutUs", aboutUs);
 }
    //--------------------------------------------------
    protected string updateAboutUs(AboutUs about)
    {
        string ids = "";
        try
        {
            Open();
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = DataBase;
            //Procedure Name.
            cmd.CommandText = "Upd_AboutUs";
            cmd.CommandType = CommandType.StoredProcedure;
            //Procedure Parameters.
            cmd.Parameters.Add("@AbouId", SqlDbType.Int);
            cmd.Parameters.Add("@SiteId", SqlDbType.Int);
            cmd.Parameters.Add("@AbouOrdPos", SqlDbType.Int);
            cmd.Parameters.Add("@AbouTitle", SqlDbType.VarChar, 250, "AbouTile");
            cmd.Parameters.Add("@AbouSubTitle", SqlDbType.VarChar, 250, "AbouSubTitle");
            cmd.Parameters.Add("@AbouImage", SqlDbType.VarChar, 250, "AbouImage");
            cmd.Parameters.Add("@AbouImageAlt", SqlDbType.VarChar, 150, "AbouImageAlt");
            cmd.Parameters.Add("@AbouLink", SqlDbType.VarChar, 250, "AbouLink");
            cmd.Parameters.Add("@AboutLink2", SqlDbType.VarChar, 250, "AboutLink2");
            cmd.Parameters.Add("@AbouContent", SqlDbType.VarChar, 20000, "AbouContent");
            cmd.Parameters.Add("@AbouState", SqlDbType.Bit);
            //Setting values to Parameters.
            cmd.Parameters[0].Value = about.AboutId;
            cmd.Parameters[1].Value = about.SiteId;
            cmd.Parameters[2].Value = about.AbouOrdPos;
            cmd.Parameters[3].Value = about.AbouTitle;
            cmd.Parameters[4].Value = about.AbouSubTitle;
            cmd.Parameters[5].Value = about.AbouImage;
            cmd.Parameters[6].Value = about.AbouImageAlt;
            cmd.Parameters[7].Value = about.AbouLink;
            cmd.Parameters[8].Value = about.AbouLink2;
            cmd.Parameters[9].Value = about.AbouContent;
            cmd.Parameters[10].Value = about.AbouState;
            SqlDataReader dr = cmd.ExecuteReader();
            if (dr.HasRows)
            {
                while (dr.Read())
                { ids = dr["id"].ToString(); }
            }
            dr.Close();
            dr.Dispose();
        }
        catch (SqlException oSqlExp)
        {
            //Console.WriteLine("" + oSqlExp.Message);
        }
        catch (Exception oEx)
        {
            //Console.WriteLine("" + oEx.Message);

        }
        return ids;
    }
 /// <summary>
 /// Create a new AboutUs object.
 /// </summary>
 /// <param name="about_ID">Initial value of about_ID.</param>
 public static AboutUs CreateAboutUs(int about_ID)
 {
     AboutUs aboutUs = new AboutUs();
     aboutUs.about_ID = about_ID;
     return aboutUs;
 }