Exemplo n.º 1
0
 /// <summary>
 /// Remove a service from the database
 /// </summary>
 /// <param name="entity">service to remove</param>
 public void Remove(Service service)
 {
     Session.Delete(service);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Add a service to the database
 /// </summary>
 /// <param name="entity">service to add</param>
 public void Add(Service service)
 {
     Session.Save(service);
 }
Exemplo n.º 3
0
        public JsonResult AddService()
        {
            try
            {
                ServiceRepository serviceRepo = new ServiceRepository();

                Service service = new Service();
                service.IsActive = true;
                service.Name = Request.Form["Name"];
                service.Price = decimal.Parse(Request.Form["Cost"]);

                serviceRepo.Add(service);

                return Json(new
                {
                    error = false,
                    Name = service.Name,
                    Id = service.Id
                });
            }
            catch
            {
                return Json(new
                {
                    error = true
                });
            }
        }