Example #1
0
        public bool Add(OwnerViewModel objAdd)
        {
            var newRow = new People
            {
                Name  = objAdd.Name,
                Last1 = objAdd.Last1,
                Last2 = objAdd.Last2
            };

            Context.People.Add(newRow);

            Context.SaveChanges();
            return(true);
        }
Example #2
0
        public bool Edit(OwnerViewModel val)
        {
            var model = Context.People.FirstOrDefault(e => e.ID == val.ID);

            if (model == null)
            {
                throw new ArgumentNullException(nameof(model));
            }

            model.Name  = val.Name;
            model.Last1 = val.Last1;
            model.Last2 = val.Last2;
            Context.SaveChanges();

            return(true);
        }