public DeletePostureConstraintResponse DeletePostureConstraint(DeletePostureConstraintRequest request) { try { var postureConstraint = new PostureConstraint { Id = request.Id }; DataContext.PostureConstraints.Attach(postureConstraint); DataContext.PostureConstraints.Remove(postureConstraint); DataContext.SaveChanges(); return(new DeletePostureConstraintResponse { IsSuccess = true, Message = "The item has been deleted successfully", }); } catch { return(new DeletePostureConstraintResponse { IsSuccess = false, Message = "An error occured, please contact the administrator for further information" }); } }
public void Write(TProtocol oprot) { oprot.IncrementRecursionDepth(); try { TStruct struc = new TStruct("MConstraint"); oprot.WriteStructBegin(struc); TField field = new TField(); if (ID == null) { throw new TProtocolException(TProtocolException.INVALID_DATA, "required field ID not set"); } field.Name = "ID"; field.Type = TType.String; field.ID = 1; oprot.WriteFieldBegin(field); oprot.WriteString(ID); oprot.WriteFieldEnd(); if (GeometryConstraint != null && __isset.GeometryConstraint) { field.Name = "GeometryConstraint"; field.Type = TType.Struct; field.ID = 2; oprot.WriteFieldBegin(field); GeometryConstraint.Write(oprot); oprot.WriteFieldEnd(); } if (VelocityConstraint != null && __isset.VelocityConstraint) { field.Name = "VelocityConstraint"; field.Type = TType.Struct; field.ID = 3; oprot.WriteFieldBegin(field); VelocityConstraint.Write(oprot); oprot.WriteFieldEnd(); } if (AccelerationConstraint != null && __isset.AccelerationConstraint) { field.Name = "AccelerationConstraint"; field.Type = TType.Struct; field.ID = 4; oprot.WriteFieldBegin(field); AccelerationConstraint.Write(oprot); oprot.WriteFieldEnd(); } if (PathConstraint != null && __isset.PathConstraint) { field.Name = "PathConstraint"; field.Type = TType.Struct; field.ID = 5; oprot.WriteFieldBegin(field); PathConstraint.Write(oprot); oprot.WriteFieldEnd(); } if (JointPathConstraint != null && __isset.JointPathConstraint) { field.Name = "JointPathConstraint"; field.Type = TType.Struct; field.ID = 6; oprot.WriteFieldBegin(field); JointPathConstraint.Write(oprot); oprot.WriteFieldEnd(); } if (PostureConstraint != null && __isset.PostureConstraint) { field.Name = "PostureConstraint"; field.Type = TType.Struct; field.ID = 7; oprot.WriteFieldBegin(field); PostureConstraint.Write(oprot); oprot.WriteFieldEnd(); } if (JointConstraint != null && __isset.JointConstraint) { field.Name = "JointConstraint"; field.Type = TType.Struct; field.ID = 8; oprot.WriteFieldBegin(field); JointConstraint.Write(oprot); oprot.WriteFieldEnd(); } if (Properties != null && __isset.Properties) { field.Name = "Properties"; field.Type = TType.Map; field.ID = 9; oprot.WriteFieldBegin(field); { oprot.WriteMapBegin(new TMap(TType.String, TType.String, Properties.Count)); foreach (string _iter4 in Properties.Keys) { oprot.WriteString(_iter4); oprot.WriteString(Properties[_iter4]); } oprot.WriteMapEnd(); } oprot.WriteFieldEnd(); } oprot.WriteFieldStop(); oprot.WriteStructEnd(); } finally { oprot.DecrementRecursionDepth(); } }