public bool DisableActualStatus() { try { var status = _acRepositry.GetAll().ToList(); ActualStatus actualStatus; if (!status.Any()) { actualStatus = new ActualStatus { IsEditable = false }; _acRepositry.Add(actualStatus); _acRepositry.SaveChanges(); return true; } actualStatus = status.Last(); actualStatus.IsEditable = false; _acRepositry.SaveChanges(); return true; } catch (Exception) { return false; } }
/// <summary> /// Create a new ActualStatus object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="isEditable">Initial value of the IsEditable property.</param> /// <param name="objectInfo">Initial value of the ObjectInfo property.</param> /// <param name="start">Initial value of the Start property.</param> /// <param name="end">Initial value of the End property.</param> public static ActualStatus CreateActualStatus(global::System.Int32 id, global::System.Boolean isEditable, ObjectInfo objectInfo, global::System.Int32 start, global::System.Int32 end) { ActualStatus actualStatus = new ActualStatus(); actualStatus.Id = id; actualStatus.IsEditable = isEditable; actualStatus.ObjectInfo = StructuralObject.VerifyComplexObjectIsNotNull(objectInfo, "ObjectInfo"); actualStatus.Start = start; actualStatus.End = end; return actualStatus; }
/// <summary> /// Deprecated Method for adding a new object to the ActualStatus EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToActualStatus(ActualStatus actualStatus) { base.AddObject("ActualStatus", actualStatus); }