Ejemplo n.º 1
0
        public void Update(PropertyTypeView model, int CoreSystemUserId)
        {
            try
            {
                using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
                {
                    DataAccess.PropertyType table = db.PropertyTypes.FirstOrDefault(x => x.PropertyTypeId == model.PropertyTypeId);

                    LoadEditLogDetails(table.PropertyTypeId, CoreSystemUserId);

                    JazMax.BusinessLogic.ChangeLog.ChangeLogService.LogChange(table.TypeName, model.TypeName, "Property Type");

                    if (table != null)
                    {
                        table.IsActive = true;
                        table.TypeName = model.TypeName;
                        db.SaveChanges();
                    }
                }
            }
            catch (Exception e)
            {
                JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
            }
        }
Ejemplo n.º 2
0
        public PropertyTypeView GetById(int?Id)
        {
            PropertyTypeView model = null;

            try
            {
                if (Id != null)
                {
                    using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
                    {
                        model = (db.PropertyTypes.Where(x => x.PropertyTypeId == Id).Select(x => new PropertyTypeView
                        {
                            isActive = x.IsActive,
                            PropertyTypeId = x.PropertyTypeId,
                            TypeName = x.TypeName
                        }))?.FirstOrDefault();
                        return(model);
                    }
                }
            }
            catch (Exception e)
            {
                JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
            }
            return(model);
        }
 public JsonResult CreateType(string txtTypeName)
 {
     try
     {
         PropertyTypeView model = new PropertyTypeView()
         {
             TypeName = txtTypeName
         };
         o.Create(model);
         return(Json(new { Result = "Success", Message = "Saved Successfully" }, JsonRequestBehavior.AllowGet));
     }
     catch
     {
         return(Json(new { Result = "Error!", Message = "Please try again" }, JsonRequestBehavior.AllowGet));
     }
 }
Ejemplo n.º 4
0
 public void Create(PropertyTypeView model)
 {
     try
     {
         using (JazMax.DataAccess.JazMaxDBProdContext db = new JazMax.DataAccess.JazMaxDBProdContext())
         {
             DataAccess.PropertyType table = new DataAccess.PropertyType()
             {
                 IsActive = true,
                 TypeName = model.TypeName
             };
             db.PropertyTypes.Add(table);
             db.SaveChanges();
         }
     }
     catch (Exception e)
     {
         JazMax.BusinessLogic.AuditLog.ErrorLog.LogError(e, 0);
     }
 }