Example #1
0
        public ActionResult Line(Models.Config.Line line)
        {
            ModelState.Clear();

            if (ModelState.IsValid)
            {
                if (line.IsDelete)
                {
                    bool isDeleted = Database.DeleteLine(line.Id);
                    if (!isDeleted)
                    {
                        line.IsFailed = true;
                        return(View(line));
                    }
                }
                else
                {
                    var dbLine = Mapper.Map <AdapterDb.Line>(line);

                    bool isSaved = Database.SaveLine(dbLine);
                    if (!isSaved)
                    {
                        line.IsFailed = true;
                        return(View(line));
                    }
                }

                return(RedirectToAction("Businesses"));
            }

            return(View(line));
        }
Example #2
0
        public ActionResult Line(int businessId, int?lineId)
        {
            var line = new Models.Config.Line();

            if (lineId.HasValue)
            {
                var dbLine = Database.GetLine(lineId.Value);
                line = Mapper.Map <Models.Config.Line>(dbLine);
            }
            else
            {
                line.BusinessId = businessId;
            }

            return(View(line));
        }